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 16:36:32 +0100	[thread overview]
Message-ID: <42f199ba-8905-4846-9768-54342244610e@foss.st.com> (raw)
In-Reply-To: <ZcZYqBMGsUnaWixS@calimero.vinschen.de>



On 2024-02-09 17:54, Corinna Vinschen wrote:
> On Feb  9 08:40, Andrew Pinski wrote:
>> On Fri, Feb 9, 2024 at 8:30 AM Torbjorn SVENSSON
>> <torbjorn.svensson@foss.st.com> wrote:
>>>
>>> Hi all,
>>>
>>> I've been trying to run tests for arm-none-eabi on GCC14 tree.
>>> What I've seen is that fileno() is not available. If you look though the
>>> header files, I see that this is guarded by __POSIX_VISIBLE and due to a
>>> recent change in the GCC testsuite (part of PR96395), they moved the
>>> test case to gcc/testsuite/c-c++-common/analyzer/fileno-1.c and then
>>> invoke it with g++ and -std=c++98. With this change, strict ANSI is
>>> defined, but not __POSIX_VISIBLE.
>>
>> Note the testcase failure is recorded as https://gcc.gnu.org/PR113278 .
>>
>>>
>>> If I run the same test on the native g++ tool in Ubuntu, I instead get
>>> that __USE_POSIX is set (the guard for fileno() in glibc), so this
>>> differs from the behavior noticed with newlib.
>>
>> That is also due to _GNU_SOURCE being defined for C++ for Linux/g++. I
>> think this is just a GCC testcase issue rather than something needing
>> to be fixed in newlib even.
> 
> Along these lines, note the Linux man page for fileno:
> 
>      STANDARDS
>         POSIX.1-2008.
> 
>      HISTORY
>        POSIX.1-2001.
> 
> and the feature test in GLibc's stdio.h:
> 
>      #ifdef  __USE_POSIX
>      /* Return the system file descriptor for STREAM.  */
>      extern int fileno (FILE *__stream) __THROW __wur;
>      #endif /* Use POSIX.  */
> 
> 
> Corinna
> 


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.

Kind regards,
Torbjörn

  reply	other threads:[~2024-02-12 15:36 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 [this message]
2024-02-12 16:33       ` Corinna Vinschen
2024-02-12 16:40         ` Corinna Vinschen
2024-02-12 17:11           ` Torbjorn SVENSSON
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=42f199ba-8905-4846-9768-54342244610e@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).