Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: syssrc/sys/sys



On Thu, Dec 20, 2001 at 10:07:24PM +0200, Jason R Thorpe wrote:
> 
> Modified Files:
>       syssrc/sys/sys: featuretest.h
> 
> Log Message:
> >From the comment added to the file:
> 
>  * NOTE: Do not protect this header against multiple inclusion.  Doing
>  * so can have subtle side-effects due to header file inclusion order
>  * and testing of e.g. _POSIX_SOURCE vs. _POSIX_C_SOURCE.  Instead,
>  * protect each CPP macro that we want to supply.

In looking through the source files in /usr/xsrc/xfree (XFree86-4.1.0 sources),
I saw something like the following in many files:

        #define _POSIX_SOURCE
        #include <signal.h>     /* includes <sys/featuretest.h> */
        #undef _POSIX_SOURCE

Currently, after the indirect inclusion of <sys/featuretest.h> through
<signal.h>, the CPP macro _POSIX_C_SOURCE is always defined, whereas before,
it may have been defined depending what other headers were included before
the inclusion of <signal.h> that also included <sys/featuretest.h>.  In
particular, this causes xsrc/xfree/xc/programs/xdm/session.c to not build
on a 1.5ZA system from the latest i386 snapshot (20011222); session.c includes
dm.h which includes <setjmp.h> in exactly the way described above.  Should I
now be changing the lines to look like:

        #define _POSIX_SOURCE
        #include <signal.h>     /* includes <sys/featuretest.h> */
        #undef _POSIX_SOURCE
        #ifdef _POSIX_C_SOURCE
        #undef _POSIX_C_SOURCE
        #endif

or is some other solution recommended?

        Thanks,

        -- Johnny Lam <jlam%netbsd.org@localhost>



Home | Main Index | Thread Index | Old Index