Re: POSIX_C_SOURCE

From: Malcolm Kay (malcolm.kay_at_internode.on.net)
Date: 09/01/03

  • Next message: Ruben van Staveren: "Re: kernel: wi0: timeout in wi_seek"
    To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, troy@twisted.net
    Date: Mon, 1 Sep 2003 12:17:13 +0930
    
    

    On Sun, 31 Aug 2003 02:19, Garrett Wollman wrote:
    > In article <20030830161813.GA28890@twisted.net> 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.
    >

    The warnings are only wrong in your personal interpretation of right and
    wrong. Many gcc options generate warnings with legal C source and this is
    permitted by the C standard (whether or not it is controlled by a compiler
    option) provided it does not prevent generation of correct code.

    The warning is true: that is _POSIX_C_SOURCE is not defined (and is evaluated
    in an #if preprocessor statement).

    The warning only appears when -Wundef option is used which relates
    specifically to this circumstance. GCC people surely cannot be criticised
    for an option that works precisely as documented.

    No-one individually has it wrong.
    The problem is one of incompatibility between the header files and the
    compiler options selected. Since the compiler options are probably set for a
    range of environments it is probably best to adapt the system header files to
    circumvent the difficulty.

    Malcolm Kay

    _______________________________________________
    freebsd-stable@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-stable
    To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"


  • Next message: Ruben van Staveren: "Re: kernel: wi0: timeout in wi_seek"

    Relevant Pages

    • Re: 2.6.5-rc1-tiny1 for small systems
      ... > This is the latest release of the -tiny kernel tree. ... looks like my gcc does not like ... Now, actual warnings for eisa-bus.c, followed by .config ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH]: Cleanup: Remove gcc format string warnings when compiling with -Wformat-securit
      ... Remove gcc format string warnings when compiling with -Wformat-security ...
      (Linux-Kernel)
    • Re: how to cast from (void*) to other types?
      ... warnings using gcc, I get no warnings. ... If not you are either not doing what you say or you are using a broken version of gcc. ... The reason I know that all working version of gcc produce a warning or error for the code you've described is that integer types, such as int, are not assignment compatible with pointers of any type, so for a compiler to conform to the standard it is *required* to produce a diagnostic and the code is *not* required to work even if you add in a cast to shut the compiler up. ...
      (comp.lang.c)
    • Re: howto get rid of pointer arguments differ in signedness
      ... Since the code Over the past decade or so, gcc ... Why is this warning different from any of the other warnings that gcc ... modify the compiler settings such that it is never displayed anymore. ... to fix it. ...
      (comp.os.linux.development.apps)
    • Re: K&R2 section 2.7 type conversions (exercise)
      ... fix the errors and warnings gcc is reporting. ... arrays to functions, how to match prototype with function definition, ... declaring objects before trying to use them and scope of various types ...
      (comp.lang.c)