]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Override detection of flockfile support in newlib [PR123406]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 6 Jan 2026 14:00:09 +0000 (14:00 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 7 Jan 2026 15:20:51 +0000 (15:20 +0000)
As explained in the PR, flockfile and funlockfile are always declared by
newlib and there's no easy way to detect whether they're actually
defined. Ensure that ac_stdio_locking=no gets set for non-cygwin newlib
targets.

libstdc++-v3/ChangeLog:

PR libstdc++/123406
* acinclude.m4 (GLIBCXX_CHECK_STDIO_LOCKING): Override detection
of flockfile for non-cygwin newlib targets.
* configure: Regenerate.

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/acinclude.m4
libstdc++-v3/configure

index 103515c000f4618d93b926f0a435e5c3c551713b..e6723edf880e75e28b7862926dcd7cfc8dd73809 100644 (file)
@@ -5822,13 +5822,20 @@ AC_LANG_SAVE
   AC_MSG_CHECKING([whether flockfile and putc_unlocked are defined in <stdio.h>])
   AC_TRY_COMPILE([
   #include <stdio.h>
+  #if __has_include(<newlib.h>)
+  # ifdef __CYGWIN__
+    // Cygwin has working flockfile
+  # else
+  #  error No usable flockfile on most newlib targets
+  # endif
+  #endif
   ],[
     FILE* f = ::fopen("", "");
     ::flockfile(f);
     ::putc_unlocked(' ', f);
     ::funlockfile(f);
     ::fclose(f);
-  ], [ac_stdio_locking=yes], [ac_stdio_locking=no])
+  ],[ac_stdio_locking=yes],[ac_stdio_locking=no])
   AC_MSG_RESULT($ac_stdio_locking)
 
   if test "$ac_stdio_locking" = yes; then
index 0469cbe0f59c8d4eb0263e56dab20f6f3d082d18..3d825a69fa2e7cb266ac219c38eeddefbcc940d6 100755 (executable)
@@ -55051,6 +55051,13 @@ $as_echo_n "checking whether flockfile and putc_unlocked are defined in <stdio.h
 /* end confdefs.h.  */
 
   #include <stdio.h>
+  #if __has_include(<newlib.h>)
+  # ifdef __CYGWIN__
+    // Cygwin has working flockfile
+  # else
+  #  error No usable flockfile on most newlib targets
+  # endif
+  #endif
 
 int
 main ()