delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/10/10/14:43:09

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
X-Cloudmark-SP-Filtered: true
X-Cloudmark-SP-Result: v=1.1 cv=sOeZmqKXo9QeAvPHcA4bYEQFU2ce9l+aXDqfA8Y5Yr0= c=1 sm=1 a=W5crty74aesA:10 a=Bqtapk49eCgA:10 a=SV9grZ613K4A:10 a=BLceEmwcHowA:10 a=i7s4YuWtaOcA:10 a=IkcTkHD0fZMA:10 a=IaHBZPgZ0vV7m0nTkA8unw==:17 a=mDV3o1hIAAAA:8 a=uZvujYp8AAAA:8 a=gfyxrlcoK0fQs-ETSeIA:9 a=LGmIR0ZEIUtg8YCERcgA:7 a=QEXdDO2ut3YA:10 a=93JMsz_FyScA:10 a=nv2HPNHG-XcA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
To: <corinna-cygwin AT cygwin DOT com>
Subject: Re: stdio.h: broken standard compliance.
MIME-Version: 1.0
Date: Mon, 10 Oct 2011 11:42:45 -0700
From: Kaz Kylheku <kaz AT kylheku DOT com>
Cc: <cygwin AT cygwin DOT com>
Message-ID: <203df9f173be7f13d23b3e7c0fc831c1@127.0.0.1>
X-Sender: kaz AT kylheku DOT com
User-Agent: Roundcube Webmail/0.4
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019