bug-gnulib
[Top][All Lists]
Advanced

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

Re: split stdio-safer into fopen-safer, tmpfile-safer


From: Eric Blake
Subject: Re: split stdio-safer into fopen-safer, tmpfile-safer
Date: Fri, 28 Jul 2006 19:53:05 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]