Mismatch between newlib and glibc regarding fileno
Corinna Vinschen
vinschen@redhat.com
Fri Feb 9 16:54:00 GMT 2024
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
More information about the Newlib
mailing list