This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: cygwin 1.5.24-2 gcc 3.4.4 stdio.h
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: Paul Edwards <mutazilah at gmail dot com>
- Cc: newlib at sources dot redhat dot com
- Date: Fri, 30 Nov 2007 13:39:47 -0500
- Subject: Re: cygwin 1.5.24-2 gcc 3.4.4 stdio.h
- References: <0a1701c832ea$21aed0a0$6501a8c0@paul>
Paul Edwards wrote:
Dave Korn wrote...
"-ansi" is meant to mask all the Posix stuff and just provide pure ANSI C89
headers.
Agreed. I don't know if it's a goal of newlib to support strict C89
conformance or not,
It's not a C compiler if it fails to even conform to the C89 standard.
but I don't see how it could hurt to add a few #ifndef
__STRICT_ANSI__ here and there.
They're already there in fact, just not accurate. It's a bug, basically.
It probably used to work and someone broke it.
A Cygwin change added a number of the _POSIX flags inside
sys/features.h. This could easily be modified to have a check for
strict C89 ANSI in it.
I have attached a proposed patch. Any comments from the Cygwin folks?
However, this one I had no answer for:
sys/signal.h has:
/* #ifndef __STRICT_ANSI__*/
#if defined(_POSIX_THREADS)
#include <sys/types.h> /* for pthread data types */
#endif
So it obviously used to be set up to handle ANSI, but it was replace with
this _POSIX_THREADS. I could reverse that change, but I don't know
whether that is the right thing to do. Alternatively I could stop the various
files from including feature.h which is what defines that _POSIX_THREADS.
The proposal above should fix this problem.
-- Jeff J.
Index: features.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/features.h,v
retrieving revision 1.12
diff -u -p -r1.12 features.h
--- features.h 13 Jun 2007 17:44:24 -0000 1.12
+++ features.h 30 Nov 2007 18:36:09 -0000
@@ -81,6 +81,8 @@ extern "C" {
#endif
#ifdef __CYGWIN__
+
+#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
#define _POSIX_VERSION 200112L
#define _POSIX2_VERSION 200112L
#define _XOPEN_VERSION 600
@@ -164,7 +166,8 @@ extern "C" {
/* #define _XOPEN_STREAMS -1 */
/* #define _XOPEN_UNIX -1 */
-#endif
+#endif /* !__STRICT_ANSI__ || __cplusplus || __STDC_VERSION__ >= 199901L */
+#endif /* __CYGWIN__ */
#ifdef __SPU__
/* Not much for now! */