On Thu, Nov 13, 2025, 16:32 Emanuele Torre <torreemanuele6@gmail.com> wrote:
> The 81d85842687 commit from 2025-11-13 introduced an fpurge (stdout) in
> sig.c
>
> When compiling using:
> $ gcc --version|sed q
> gcc (Gentoo 14.3.1_p20250801 p4) 14.3.1 20250801
> $ /usr/lib/ld-linux.so.2 --version|sed q
> ld.so (Gentoo 2.41-r6 (patchset 8)) stable release version 2.41.
>
> I get the following error:
> ../sig.c: In function ‘throw_to_top_level’:
> ../sig.c:467:5: error: implicit declaration of function ‘fpurge’
> [-Wimplicit-function-declaration]
> 467 | fpurge (stdout);
> | ^~~~~~
>
> Reading the fpurge(3) man page I see
> SYNOPSIS
> /* unsupported */
> #include <stdio.h>
>
> int fpurge(FILE *stream);
>
> /* supported */
> #include <stdio.h>
> #include <stdio_ext.h>
>
> void __fpurge(FILE *stream);
>
> Suggesting that glibc does not suport fpurge(), only __fpurge that is
> defined in the stdio_ext.h header.
>
> o/
> emanuele6
The fix is to add #define NEED_FPURGE_DECL before including shell.h in
sig.c.
I'm not sure why, but the declaration in externs.h is guarded by both
NEED_FPURGE_DECL and !HAVE_DECL_FPURGE.