Re: [PATCH] Fixes compile failure if REENTRANT_SYSCALLS_PROVIDED and MISSING_SYSCALL_NAMES defined

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Jan 16 15:00, Markus Eisenmann wrote:
> Hi!
> 
> The attached patch will fix some compiler issues if the macros REENTRANT_SYSCALLS_PROVIDED and  MISSING_SYSCALL_NAMES ...
> 
> In case of stdio/fopen.c and stdio64/fopen64.c compiling with a newer compiler like GCC 14.2 will
> abort with an error like "implicit declaration of ...", because the open() - as replacement of _open_r (see reent.h) -
> isn't declared; I.e., including <fcntl.h> unconditionaly fixes this compile-issue.
> Note: Older GCC's are more "relaxed" and - for example GCC 11.3 - does not warn about this implicit declaration ?!
> 
> Another similar issue was replacing _rename_r by rename() in stdio/rename.c whitch caused a "forever-
> loop" or stack-overflow by recursion - depending on the optimization level.
> 
> Best regards from Austria,
> Markus

> From 020ef623fa0e49cf3c346ff0df53376c29a65f33 Mon Sep 17 00:00:00 2001
> From: Markus Eisenmann <[email protected]>
> Date: Thu, 16 Jan 2025 15:13:54 +0100
> Subject: [PATCH] Fixes compile failure if REENTRANT_SYSCALLS_PROVIDED and
>  MISSING_SYSCALL_NAMES defined
> 
> If the macros REENTRANT_SYSCALLS_PROVIDED and MISSING_SYSCALL_NAMES are defined some
> _reent_*-functions are replaced by the system-call and this leads to compile-warning
> or a runtime-failure.
> 
>  * newlib/libc/stdio/fopen.c _open_r is replaces by open(), declared in <fcntl.h>
>  * newlib/libc/stdio64/fopen64.c ditto
>  * newlib/libc/stdio/rename.c _rename_r is rename() itself; i.e, fix recursion
> ---
>  newlib/libc/stdio/fopen.c     | 2 --
>  newlib/libc/stdio/rename.c    | 3 ++-
>  newlib/libc/stdio64/fopen64.c | 2 --
>  3 files changed, 2 insertions(+), 5 deletions(-)

Pushed.

Thanks,
Corinna
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.