From d0a3c484ef7de51d8afdb47c177fcdaad92e1a9d Mon Sep 17 00:00:00 2001 From: lotherk Date: Mon, 23 Nov 2026 12:35:14 +0000 Subject: [PATCH] curses: the vendored fpurge only where the libc has none NetBSD declares fpurge() in , so a static definition in the vendored libcurses contradicts the prototype and -Werror stops the cross build (static declaration of 'fpurge' follows non-static declaration, build/logs/release-2026-11-23h-cross.log:21830). FreeBSD was the only libc the guard knew about; the four BSDs and macOS all carry the call. Test: x86_64--netbsd-gcc -std=gnu11 -I. -I./libterminfo -I build/obj/destdir.amd64/usr/include -c libcurses/tty.c -> rc=0, no errors. --- vendor/netbsd-curses/libcurses/tty.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vendor/netbsd-curses/libcurses/tty.c b/vendor/netbsd-curses/libcurses/tty.c index 7dcdb9a..0ccbf06 100644 --- a/vendor/netbsd-curses/libcurses/tty.c +++ b/vendor/netbsd-curses/libcurses/tty.c @@ -592,7 +592,14 @@ isendwin(void) return _cursesi_screen->endwin ? TRUE : FALSE; } -#ifndef __FreeBSD__ +/* NetBSD declares fpurge() in (and so does every libc that kept + * the 4.4BSD call): a static definition here then contradicts the prototype + * -- "static declaration of 'fpurge' follows non-static declaration", which + * stopped the cross build (build/logs/release-2026-11-23h-cross.log:21830). + * The vendored copy is only for systems that have neither, __FreeBSD__ was + * the first of them. */ +#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && \ + !defined(__DragonFly__) && !defined(__OpenBSD__) static int fpurge(FILE *f) { //dprintf(666, "warning: called fpurge\n"); fflush(f);