Paul Eggert <eggert <at> CS.UCLA.EDU> writes: > > With Bison I wanted fopen_safer but not tmpfile_safer (I think tmpfile > is not that safe due to signals and whatnot), so I split the fopen-safer > module into two, as follows:
/usr/ucb/cc on Solaris 7 didn't like fopen-safer or tmpfile-safer: cc -Xc -D__EXTENSIONS__ -DHAVE_CONFIG_H -I. -I../../lib -I.. -g - c ../../lib/fopen-safer.c ucbcc: Warning: "-Xc" redefines compatibility mode from "SunC transition" to "strict ANSI" "../../lib/fopen-safer.c", line 58: warning: improper pointer/integer combination: op "=" cc -Xc -D__EXTENSIONS__ -DHAVE_CONFIG_H -I. -I../../lib -I.. -g - c ../../lib/tmpfile-safer.c ucbcc: Warning: "-Xc" redefines compatibility mode from "SunC transition" to "strict ANSI" "../../lib/tmpfile-safer.c", line 44: warning: improper pointer/integer combination: op "=" "../../lib/tmpfile-safer.c", line 65: warning: improper pointer/integer combination: op "=" I traced this to </usr/ucbinclude/stdio.h>, which does: #if __STDC__ == 0 || defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) /* non-ANSI standard compilation */ extern FILE *fdopen(int, const char *); which is different than </usr/include/stdio.h>: #if defined(__EXTENSIONS__) || __STDC__ == 0 || \ defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) extern FILE *fdopen(int, const char *); Should the extensions module be extended to check for and define _POSIX_SOURCE, to coax the compiler into admitting that fdopen exists? Also, why is extensions.m4 doing this? Should it be using #ifdef instead? #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif -- Eric Blake