cvs commit: src/sys/sys cdefs.h

Bruce Evans bde at zeta.org.au
Fri Oct 31 04:15:46 PST 2003


On Thu, 30 Oct 2003, Peter Wemm wrote:

> peter       2003/10/30 21:42:53 PST
>
>   FreeBSD src repository
>
>   Modified files:
>     sys/sys              cdefs.h
>   Log:
>   While not illegal, attempt to pacify gcc -Wundef.  It just so happens
>   that libtool-using packages seem to love using this flag.
>
>   /usr/include/sys/cdefs.h:184:5: warning: "__STDC_VERSION__" is not defined
>   /usr/include/sys/cdefs.h:372:5: warning: "_POSIX_C_SOURCE" is not defined
>   /usr/include/sys/cdefs.h:378:5: warning: "_POSIX_C_SOURCE" is not defined

It (this pacification, not the previous version) is illegal (in my style
rules :-).  Please back this out.

The bug seems to be mainly in:

%%%
RCS file: /home/ncvs/src/contrib/gcc/toplev.c,v
Working file: toplev.c
head: 1.22
...
----------------------------
revision 1.22
date: 2003/08/22 03:31:54;  author: kan;  state: Exp;  lines: +2 -2
Enable warn_system_heders by default.
----------------------------
Index: toplev.c
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/toplev.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -2 -r1.21 -r1.22
--- toplev.c	22 Aug 2003 03:13:20 -0000	1.21
+++ toplev.c	22 Aug 2003 03:31:54 -0000	1.22
@@ -20,5 +20,5 @@
 02111-1307, USA.  */

-/* $FreeBSD: src/contrib/gcc/toplev.c,v 1.21 2003/08/22 03:13:20 kan Exp $ */
+/* $FreeBSD: src/contrib/gcc/toplev.c,v 1.22 2003/08/22 03:31:54 kan Exp $ */

 /* This is the top level of cc1/c++.
@@ -1411,5 +1411,5 @@
 /* Don't suppress warnings from system headers.  -Wsystem-headers.  */

-int warn_system_headers = 0;
+int warn_system_headers = 1;

 /* Print various extra warnings.  -W.  */
%%%

This bogotifies enabling this warning when WARNS > 0 (by always enabling
it by default):

%%%
RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v
Working file: bsd.sys.mk
head: 1.32
...
----------------------------
revision 1.12
date: 2003/03/31 13:10:51;  author: ru;  state: Exp;  lines: +1 -0
Enable cpp(1) warnings in system headers.  GCC is oriented on
glibc which is externally maintained, so GCC ships with these
warnings turned off by default.  This is also consistent with
the src/contrib/gcc/c-lex.c,v 1.2 change.
----------------------------
Index: bsd.sys.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.sys.mk,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -2 -r1.11 -r1.12
--- bsd.sys.mk	13 Nov 2002 13:49:29 -0000	1.11
+++ bsd.sys.mk	31 Mar 2003 13:10:51 -0000	1.12
@@ -1,3 +1,3 @@
-# $FreeBSD: src/share/mk/bsd.sys.mk,v 1.11 2002/11/13 13:49:29 ru Exp $
+# $FreeBSD: src/share/mk/bsd.sys.mk,v 1.12 2003/03/31 13:10:51 ru Exp $
 #
 # This file contains common settings used for building FreeBSD
@@ -12,4 +12,5 @@
 . if defined(WARNS)
 .  if ${WARNS} > 0
+CFLAGS		+=	-Wsystem-headers
 .   if !defined(NO_WERROR)
 CFLAGS		+=	-Werror
%%%

While it is good to check for warnings in system headers, this shouldn't
be forced on everyone.  Applications that want to check for the non-error
of using undefined identifiers in cpp expressions shouldn't enable
warnings in system headers unless they want to get warnings if the headers
use this standard C feature (and other warnings).  Applications in the src
tree won't do this.

Bruce


More information about the cvs-src mailing list