From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 843 invoked by alias); 14 Dec 2015 13:34:30 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 822 invoked by uid 89); 14 Dec 2015 13:34:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-io0-f171.google.com Received: from mail-io0-f171.google.com (HELO mail-io0-f171.google.com) (209.85.223.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 14 Dec 2015 13:34:28 +0000 Received: by iofq126 with SMTP id q126so33367247iof.2 for ; Mon, 14 Dec 2015 05:34:26 -0800 (PST) X-Received: by 10.107.136.39 with SMTP id k39mr36069012iod.0.1450100065948; Mon, 14 Dec 2015 05:34:25 -0800 (PST) Received: from [192.168.0.9] (d27-96-48-76.nap.wideopenwest.com. [96.27.76.48]) by smtp.gmail.com with ESMTPSA id k6sm6444135igx.20.2015.12.14.05.34.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Dec 2015 05:34:25 -0800 (PST) Subject: Re: __STRICT_ANSI__ and stdio.h To: cygwin@cygwin.com References: <566DA207.3080008@gmail.com> From: cyg Simple X-Enigmail-Draft-Status: N1110 Message-ID: <566EC57B.102@gmail.com> Date: Mon, 14 Dec 2015 13:34:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-12/txt/msg00153.txt.bz2 On 12/13/2015 11:56 PM, KIMURA Masaru wrote: > Hi, > >>> is cygwin's __STRICT_ANSI__ and stdio.h behavior not so compatible to glibc's? >>> especially, i meant routines in POSIX 1003.1:2001 (popen(), pclose(), etc). >>> for a specific example, see a cparser issue[1] i submitted. >>> >> >> Cygwin isn't wrong. __STRICT_ANSI__ doesn't mix with POSIX. >> __STRICT_ANSI__ definitions is what you should look at for the defined >> API; not POSIX 1003.1:2001. > > then why does glibc look accepting -std=c99 -D_POSIX_C_SOURCE=200809L? You'll have to ask glibc why it does this. That doesn't change the fact that -std=c99 implies -ansi in gcc. And you define what ever you like with -D on the command line; regardless if it is right or wrong. > so you mean linux (maybe glibc?) is wrong and cygwin (maybe newlib?) is right? Maybe both are correct and the discrepancy is implementation specific. Maybe you mean the build of glibc uses the above but glibc is defining the functions and not just declaring them. If glibc headers are declaring popen()/pclose() even if __STRICT_ANSI__ is defined I would dare to say they are incorrect in implementation. > > w/ attached source that uses popen()/pclose() via gcc -std=c99, > Attaching source code doesn't resolve the fact that popen()/pclose() are POSIX specific and you've asked for __STRICT_ANSI__ which eliminates the declarations that are not ANSI specific. > on cygwin (maybe newlib?), i got, > p.c: In function ‘main’: > p.c:5:2: warning: implicit declaration of function ‘popen’ > [-Wimplicit-function-declaration] > FILE *pp = popen("cat", "w"); > ^ > p.c:5:13: warning: initialization makes pointer from integer without a cast > FILE *pp = popen("cat", "w"); > ^ > p.c:12:3: warning: implicit declaration of function ‘pclose’ > [-Wimplicit-function-declaration] > int err = pclose(pp); > ^ > > on linux (maybe glibc?), i got, > p.c: In function 'main': > p.c:4:14: warning: unused parameter 'argc' [-Wunused-parameter] > int main(int argc, char *argv[]) { > ^ > p.c:4:26: warning: unused parameter 'argv' [-Wunused-parameter] > int main(int argc, char *argv[]) { > > ^ ^ Again, implementation specifics maybe. Try with -pedantic to see if it changes the result. -- cyg Simple -- 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