public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
To: Andrew Pinski <pinskia@gmail.com>, Newlib <newlib@sourceware.org>,
	Yvan Roux <yvan.roux@foss.st.com>
Subject: Re: Mismatch between newlib and glibc regarding fileno
Date: Mon, 12 Feb 2024 18:11:42 +0100	[thread overview]
Message-ID: <f764c49f-1db0-423e-b43a-4b7b80abc327@foss.st.com> (raw)
In-Reply-To: <ZcpJ6sAhJKlhPI4q@calimero.vinschen.de>



On 2024-02-12 17:40, Corinna Vinschen wrote:
> On Feb 12 17:33, Corinna Vinschen wrote:
>> On Feb 12 16:36, Torbjorn SVENSSON wrote:
>>> Okay, so newlib is more restrictive than glibc on this topic.
>>> I will prepare a patch for test cases in GCC with defining _POSIX_SOURCE  so
>>> that the test cases succeed for newlib.
>>
>> It looks like it.  But I do wonder if that's really intended by glibc.
>> I ran a quick test, first under newlibL
>>
>>    $ g++ -std=c++98 -E -dM /usr/include/features.h | grep VISIBLE
>>    #define __LARGEFILE_VISIBLE 0
>>    #define __ISO_C_VISIBLE 1999
>>    #define __XSI_VISIBLE 0
>>    #define __GNU_VISIBLE 0
>>    #define __BSD_VISIBLE 0
>>    #define __POSIX_VISIBLE 0
>>    #define __SVID_VISIBLE 0
>>    #define __ATFILE_VISIBLE 0
>>    #define __MISC_VISIBLE 0
>>
>> then under glibc:
>>
>>    $ g++ -std=c++98 -E -dM x.cc | grep '#define __USE'
>>    #define __USE_UNIX98 1
>>    #define __USE_FORTIFY_LEVEL 0
>>    #define __USE_ISOC11 1
>>    #define __USE_ISOC95 1
>>    #define __USE_ISOC99 1
>>    #define __USE_XOPEN 1
>>    #define __USE_XOPEN2K 1
>>    #define __USE_POSIX199506 1
>>    #define __USE_GNU 1
>>    #define __USE_XOPEN2KXSI 1
>>    #define __USE_XOPEN2K8 1
>>    #define __USE_POSIX 1
>>    #define __USER_LABEL_PREFIX__
>>    #define __USE_MISC 1
>>    #define __USE_POSIX2 1
>>    #define __USE_LARGEFILE64 1
>>    #define __USE_POSIX199309 1
>>    #define __USE_XOPEN2K8XSI 1
>>    #define __USE_LARGEFILE 1
>>    #define __USE_XOPEN_EXTENDED 1
>>    #define __USE_DYNAMIC_STACK_SIZE 1
>>    #define __USE_ATFILE 1
>>
>> How is it possible that with -std=c++98, everything and the kitchen sink
>> is enabled?  Is that really correct?!?
> 
> ...especially since __STRICT_ANSI__ is defined to 1 in this scenario.

Do you know any way to identify if this is the intended behavior or if 
it's an overlook in the glibc end?

Regardless if glibc is doing this deliberately or not, I suppose the 
correct thing is to manually define _POSIX_VISIBLE in the test case, right?

  reply	other threads:[~2024-02-12 17:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 16:29 Torbjorn SVENSSON
2024-02-09 16:40 ` Andrew Pinski
2024-02-09 16:54   ` Corinna Vinschen
2024-02-12 15:36     ` Torbjorn SVENSSON
2024-02-12 16:33       ` Corinna Vinschen
2024-02-12 16:40         ` Corinna Vinschen
2024-02-12 17:11           ` Torbjorn SVENSSON [this message]
2024-02-12 17:44             ` Corinna Vinschen
2024-02-12 18:14         ` Joseph Myers
2024-02-12 19:27           ` Torbjorn SVENSSON
2024-02-12 19:40             ` Corinna Vinschen
2024-02-15 17:36               ` Torbjorn SVENSSON

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f764c49f-1db0-423e-b43a-4b7b80abc327@foss.st.com \
    --to=torbjorn.svensson@foss.st.com \
    --cc=newlib@sourceware.org \
    --cc=pinskia@gmail.com \
    --cc=yvan.roux@foss.st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).