This is the mail archive of the
cygwin-xfree@cygwin.com
mailing list for the Cygwin XFree86 project.
Re: FW: __STRICT_ANSI__
- To: Harold Hunt <huntharo at msu dot edu>
- Subject: Re: FW: __STRICT_ANSI__
- From: Alan Hourihane <alanh at xfree86 dot org>
- Date: Fri, 3 Aug 2001 22:13:09 +0100
- Cc: cygx <cygwin-xfree at cygwin dot com>
- References: <NHEELHJHHFKPMAEAFMFCEEEACIAA.huntharo@msu.edu>
XFree86 wants to aim towards ansi coding styles that's why we're building
with it at the moment. This helps us catch all of the warnings/problems that
should be fixed to allow this.
But alas, I've just compiled Cygwin/XFree86 with and without -ansi and found
that with it generates 176 'implicit declaration' warnings whereas without
it there's about 12.
I'm tempted to remove the '-ansi -pedantic' until someone from the cygwin
folk can convince the newlib folk to fix the headers, but I certainly
don't have the time to tackle that problem at the moment.
If you want me to remove the '-ansi -pedantic' just let me know.
Alan.
On Tue, Jul 31, 2001 at 10:02:31PM -0400, Harold Hunt wrote:
> Alan,
>
> Here is what I wrote the Newlib list back in May, 2001 and the response that
> I received.
>
> I couldn't justify why XFree86 uses the -ansi flag, nor did I feel like
> pointing out that they were not declaring entire classes of functions when
> __STRICT_ANSI__ was defined, rather than allowing a finer-grained approach
> using additional defines like __USE_POSIX. Maybe that's all we'd have to
> mention to them to get them to accept patches, but I felt like it was going
> to be an uphill battle, so I gave up without replying. You'll probably have
> better luck.
>
> Harold
>
> -----Original Message-----
> From: newlib-owner@sources.redhat.com
> [mailto:newlib-owner@sources.redhat.com]On Behalf Of Harold Hunt
> Sent: Wednesday, May 16, 2001 3:38 PM
> To: newlib
> Subject: __STRICT_ANSI__
>
>
> 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
>
>
> -----Original Message-----
> From: newlib-owner@sources.redhat.com
> [mailto:newlib-owner@sources.redhat.com]On Behalf Of Jeff Johnston
> Sent: Wednesday, May 16, 2001 6:13 PM
> To: Harold Hunt
> Cc: newlib
> Subject: Re: __STRICT_ANSI__
>
>
> 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..
--
Core Team Member Email: alanh@XFree86.org
The XFree86 Project, Inc http://www.xfree86.org/~alanh