__STRICT_ANSI__

Jeff Johnston jjohnstn@redhat.com
Wed May 16 15:07:00 GMT 2001


Harold,

  From the gcc info files:

    The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
     is used.  Some header files may notice this macro and refrain from
     declaring certain functions or defining certain macros that the
     ANSI standard doesn't call for; this is to avoid interfering with
     any programs that might use these names for other things.

 fdopen, fileno, popen, etc.. are not ANSI functions, they are POSIX.  Newlib
has a variety of functions from ANSI, POSIX, SVID, etc..

  Any ideas why XFree86 uses the flag?

-- Jeff J..

Harold Hunt wrote:

> I can't seem to understand the conditional prototyping of some functions in
> Newlib's headers.
>
> When compiling Cygwin/XFree86, which uses -ansi, which in turn defines
> __STRICT_ANSI__, we get warnings about references implicitly declared
> functions.
>
> Below I have included the simplified prototyping of each offending function;
> I have removed other functions declared within the same #ifndef scope for
> simplicity.
>
> It looks to me like __STRICT_ANSI__ might not be being used correctly.  Any
> ideas?
>
> Harold
>
> Cygwin's stdio.h:
> #ifndef __STRICT_ANSI__
> #ifndef _REENT_ONLY
> FILE *  _EXFUN(fdopen, (int, const char *));
> #endif
> int     _EXFUN(fileno, (FILE *));
> int     _EXFUN(pclose, (FILE *));
> FILE *  _EXFUN(popen, (const char *, const char *));
> #endif
>
> GNU/Linux stdio.h:
> #ifdef __USE_POSIX
> extern FILE *fdopen (int __fd, __const char *__modes) __THROW;
> #endif
>
> #ifdef __USE_POSIX
> extern int fileno (FILE *__stream) __THROW;
> #endif
>
> #if defined __USE_POSIX2
> extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
> extern int pclose (FILE *__stream) __THROW;
> #endif
>
> Cygwin's stdlib.h:
> #ifndef __STRICT_ANSI__
> #ifndef _REENT_ONLY
> int     _EXFUN(mkstemp,(char *));
> char *  _EXFUN(mktemp,(char *));
> #endif
> #endif
>
> GNU/Linux stdlib.h:
> #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
> extern int mkstemp (char *__template) __THROW;
> #endif



More information about the Newlib mailing list