This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stdio.h: broken standard compliance.



Corinna Vinschen writes:


> $ gcc -Wall -ansi -D_POSIX_C_SOURCE=2 posix-ansi.c
^^^^^
fileno and pclose are *not* ANSI functions. Therefore, if you define
-ansi, you get the below errors. The newlib headers have explicit
#ifndef __STRICT_ANSI__ guards around the non-ANSI definitions.

Hi Corinna,


(Could you use "reply all?" for discussions so the original
person is included, but the mailing list is kept in the loop with a CC?
I had to dig your reply out of the online archives.)


I do not believe that your interpretation of the applicable standards is
entirely correct.


The -ansi flag tells the GNU *compiler* to disable its built-in
extensions. So for instance the block evaluation syntax
({ expr1; ... ; exprn }) won't be available.

The -D_POSIX_C_SOURCE=2 tells the *library headers* to enable
their extensions to a certain revision of POSIX.

With -D_POSIX_SOURCE, programs must see pclose and fileno declared
in <stdio.h>

It is not correct for those headers to be testing GCC's
compliance level  with __STRICT_ANSI__ to determine whether
to reveal these symbols.


FYI:


Summary of Feature Test Macros in the glibc documentation:

http://www.gnu.org/s/hello/manual/libc/Feature-Test-Macros.html

In your Linux manual pages:

$ man 7 feature_test_macros

In the Single Unix Specification:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02

Cheers ...


-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]