Re: POSIX_C_SOURCE

2003-08-30 Thread Matthew Dillon
This is precisely what I did a few days ago in DragonFly.  The warnings
were getting annoying.

-Matt
Matthew Dillon 
<[EMAIL PROTECTED]>

:
:On Sat, Aug 30, 2003 at 12:49:15PM -0400, Garrett Wollman wrote:
:> In article <[EMAIL PROTECTED]> you write:
:> 
:> >Any chance that someone will finally commit the fixes to prevent the
:> >POSIX_C_SOURCE warnings from showing up? I saw a number of posts on this
:> >topic, but it still seems like it's not "officially committed"
:> 
:> >/usr/include/sys/cdefs.h:273: warning: `_POSIX_C_SOURCE' is not defined
:> >/usr/include/sys/cdefs.h:279: warning: `_POSIX_C_SOURCE' is not defined
:> 
:> The warnings are wrong,[1] so you should probably ask the GCC people
:> about that.
:
:The warnings are not wrong (see below), but anyway, since -stable uses
:the "ancient" GCC 2.95.4, the GCC people are not likely to
:give a damn in either case.  They usually don't care about the older
:releases.
:
:> 
:> -GAWollman
:> 
:> [1] That is to say, any identifier used in a preprocessor expression
:> (after macro expansion) is defined to have a value of zero, and GCC
:> should not be complaining about this.
:
:The code is correct, which is why GCC only gives a warning and not an
:error.  Code looking like that are usually an indication of a
:programmer error though, so GCC is perfectly right in warning about
:it.  This is similar to the compiler warning about unused variables,
:which isn't a bug either but often indicates a programmer mistake.
:
:To make gcc shut up, you can apply the following patch to cdefs.h
:which makes the warnings go away, without changing the semantics of the
:include file in any way.
:
:
:Index: cdefs.h
:===
:RCS file: /ncvs/src/sys/sys/cdefs.h,v
:retrieving revision 1.28.2.8
:diff -u -r1.28.2.8 cdefs.h
:--- cdefs.h18 Sep 2002 04:05:13 -  1.28.2.8
:+++ cdefs.h29 Jan 2003 21:23:30 -
:@@ -269,6 +269,8 @@
:  * Our macros begin with two underscores to avoid namespace screwage.
:  */
: 
:+#ifdef _POSIX_C_SOURCE
:+
: /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
: #if _POSIX_C_SOURCE == 1
: #undef _POSIX_C_SOURCE/* Probably illegal, but beyond caring now. */
:@@ -280,6 +282,8 @@
: #undef _POSIX_C_SOURCE
: #define   _POSIX_C_SOURCE 199209
: #endif
:+
:+#endif /* _POSIX_C_SOURCE */
: 
: /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
: #ifdef _XOPEN_SOURCE
:
:
:
:
:-- 
:
:Erik Trulsson
:[EMAIL PROTECTED]
:___
:[EMAIL PROTECTED] mailing list
:http://lists.freebsd.org/mailman/listinfo/freebsd-stable
:To unsubscribe, send any mail to "[EMAIL PROTECTED]"
:

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: POSIX_C_SOURCE

2003-08-30 Thread Erik Trulsson
On Sat, Aug 30, 2003 at 12:49:15PM -0400, Garrett Wollman wrote:
> In article <[EMAIL PROTECTED]> you write:
> 
> >Any chance that someone will finally commit the fixes to prevent the
> >POSIX_C_SOURCE warnings from showing up? I saw a number of posts on this
> >topic, but it still seems like it's not "officially committed"
> 
> >/usr/include/sys/cdefs.h:273: warning: `_POSIX_C_SOURCE' is not defined
> >/usr/include/sys/cdefs.h:279: warning: `_POSIX_C_SOURCE' is not defined
> 
> The warnings are wrong,[1] so you should probably ask the GCC people
> about that.

The warnings are not wrong (see below), but anyway, since -stable uses
the "ancient" GCC 2.95.4, the GCC people are not likely to
give a damn in either case.  They usually don't care about the older
releases.

> 
> -GAWollman
> 
> [1] That is to say, any identifier used in a preprocessor expression
> (after macro expansion) is defined to have a value of zero, and GCC
> should not be complaining about this.

The code is correct, which is why GCC only gives a warning and not an
error.  Code looking like that are usually an indication of a
programmer error though, so GCC is perfectly right in warning about
it.  This is similar to the compiler warning about unused variables,
which isn't a bug either but often indicates a programmer mistake.

To make gcc shut up, you can apply the following patch to cdefs.h
which makes the warnings go away, without changing the semantics of the
include file in any way.


Index: cdefs.h
===
RCS file: /ncvs/src/sys/sys/cdefs.h,v
retrieving revision 1.28.2.8
diff -u -r1.28.2.8 cdefs.h
--- cdefs.h 18 Sep 2002 04:05:13 -  1.28.2.8
+++ cdefs.h 29 Jan 2003 21:23:30 -
@@ -269,6 +269,8 @@
  * Our macros begin with two underscores to avoid namespace screwage.
  */
 
+#ifdef _POSIX_C_SOURCE
+
 /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
 #if _POSIX_C_SOURCE == 1
 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
@@ -280,6 +282,8 @@
 #undef _POSIX_C_SOURCE
 #define_POSIX_C_SOURCE 199209
 #endif
+
+#endif /* _POSIX_C_SOURCE */
 
 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
 #ifdef _XOPEN_SOURCE




-- 

Erik Trulsson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: POSIX_C_SOURCE

2003-08-30 Thread Garrett Wollman
In article <[EMAIL PROTECTED]> you write:

>Any chance that someone will finally commit the fixes to prevent the
>POSIX_C_SOURCE warnings from showing up? I saw a number of posts on this
>topic, but it still seems like it's not "officially committed"

>/usr/include/sys/cdefs.h:273: warning: `_POSIX_C_SOURCE' is not defined
>/usr/include/sys/cdefs.h:279: warning: `_POSIX_C_SOURCE' is not defined

The warnings are wrong,[1] so you should probably ask the GCC people
about that.

-GAWollman

[1] That is to say, any identifier used in a preprocessor expression
(after macro expansion) is defined to have a value of zero, and GCC
should not be complaining about this.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


POSIX_C_SOURCE

2003-08-30 Thread Troy
Guys,

Any chance that someone will finally commit the fixes to prevent the
POSIX_C_SOURCE warnings from showing up? I saw a number of posts on this
topic, but it still seems like it's not "officially committed"

In file included from /usr/include/string.h:50,
 from /usr/X11R6/include/qcstring.h:46,
 from /usr/X11R6/include/qstring.h:42,
 from /usr/X11R6/include/qwindowdefs.h:44,
 from /usr/X11R6/include/qobject.h:43,
 from /usr/local/include/kconfigbase.h:28,
 from /usr/local/include/kconfig.h:29,
 from ksaveioconfig.cpp:20:
/usr/include/sys/cdefs.h:273: warning: `_POSIX_C_SOURCE' is not defined
/usr/include/sys/cdefs.h:279: warning: `_POSIX_C_SOURCE' is not defined
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"