https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a8891c932192eaf2b19f14958ccc662d37ec7236

commit a8891c932192eaf2b19f14958ccc662d37ec7236
Author:     Corinna Vinschen <cori...@vinschen.de>
AuthorDate: Tue Mar 4 23:26:15 2025 +0100
Commit:     Corinna Vinschen <cori...@vinschen.de>
CommitDate: Tue Mar 4 23:29:07 2025 +0100

    Cygwin: stdlib.h: resurrect arc4random_stir() definition
    
    An autoconf test for arc4random_stir() succeeds on Cygwin, because
    we export the symbol for backward compatibility.  However, when
    building with -Werror afterwards, the definition of arc4random_stir()
    is missing in the stdlib.h header, so there's a chance to encounter
    an error like this with newer GCC:
    
    sshd.c:1113:25: error: implicit declaration of function ‘arc4random_stir’; 
did you mean ‘arc4random_buf’? [-Wimplicit-function-declaration]
     1113 |                         arc4random_stir();
          |                         ^~~~~~~~~~~~~~~
          |                         arc4random_buf
    
    This occurs for instance when building OpenSSH 9.9p2 with GCC 15.0.
    
    Define arc4random_stir() as an empty macro in cygwin/stdlib.h
    to avoid the above compiler warning.
    
    Do not define arc4random_addrandom() yet, in the hope that this function
    call is really, really not used anymore.
    
    Fixes: 1cca343e4714 ("Drop redundant arc4random prototypes from 
cygwin/stdlib.h")
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/include/cygwin/stdlib.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/winsup/cygwin/include/cygwin/stdlib.h 
b/winsup/cygwin/include/cygwin/stdlib.h
index dd1077b51d2b..6191e549021f 100644
--- a/winsup/cygwin/include/cygwin/stdlib.h
+++ b/winsup/cygwin/include/cygwin/stdlib.h
@@ -20,6 +20,11 @@ extern "C"
 const char *getprogname (void);
 void   setprogname (const char *);
 
+#if __BSD_VISIBLE
+/* Cygwin exports arc4random_stir() for backward compatibility.  Define
+   here as empty macro to avoid compiler warnings. */
+#define arc4random_stir()
+#endif
 #if __GNU_VISIBLE
 char *canonicalize_file_name (const char *);
 #endif

Reply via email to