Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: syssrc/sys/sys
On Tue, Dec 25, 2001 at 11:51:13PM -0800, Johnny C. Lam wrote:
> 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?
I think the real problem is <sys/featuretest.h> trying to be too clever.
<sys/featuretest.h> probably should not be defining _POSIX_C_SOURCE. The
fact that our header files test for _POSIX_SOURCE in some places and
_POSIX_C_SOURCE in others is what caused me to make the change in the first
place; building of one of our toolchain components was failing because it
was including some header file which included <sys/featuretest.h>, then
#define'd _POSIX_SOURCE and included some other files. The problem was:
* _POSIX_SOURCE was defined when <sys/types.h> was pulled in,
so u_long was not typedef'd.
* _POSIX_C_SOURCE was not defined when <unistd.h> was pulled
in (because <sys/featuretest.h> had already been included
indirectly earlier when _POSIX_SOURCE was not defined), so
the profil() prototype was provided, which used u_long,
which was not typedef'd.
The whole thing is kind of a mess. But, looking at what xfree is doing,
I'd say it's also wrong, playing the _POSIX_SOURCE game its playing.
--
-- Jason R. Thorpe <thorpej%wasabisystems.com@localhost>
Home |
Main Index |
Thread Index |
Old Index