Commit 827cfd2080 for perl
commit 827cfd2080d196e1d686325a4c70cf24b89a66fd
Author: Yves Orton <demerphq@gmail.com>
Date: Sat Nov 14 14:46:32 2026 +0100
cflags: fix compiler flag detection with -Werror
The probe disables inline bodies but leaves static declarations behind.
GCC warns about these, so -Werror makes every candidate flag fail. Make
unused-function warnings nonfatal for this probe.
diff --git a/cflags.SH b/cflags.SH
index 3829ecdc8e..81d0a97192 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -203,12 +203,29 @@ Intel*) ;; # # Is that you, Intel C++?
*" -std="*) ;; # Already have -std=...
*) warns="-std=c99 $warns" ;;
esac
+ # Filter out -Werror from probes so unused declarations do not reject valid
+ # flags, leaving ccflags unchanged for the actual build. We tried disabling
+ # the offending warnings instead, but that raises different portability
+ # concerns. Filtering it out is the least troublesome option.
+ probe_ccflags=''
+ for flag in $ccflags
+ do
+ case "$flag" in
+ -Werror|-Werror=*) ;;
+ *) probe_ccflags="$probe_ccflags $flag" ;;
+ esac
+ done
for opt in $warns
do
case " $ccflags " in
*" $opt "*) ;; # Skip if already there.
*) rm -f _cflags$_exe
- flags="-DPERL_NO_INLINE_FUNCTIONS $ccflags $warn $stdflags $opt"
+ # TODO: Currently (5.45.5), we need -DPERL_NO_INLINE_FUNCTIONS here
+ # even with C99. Without it, GCC at -O0 emits the unused static
+ # Perl_croak_memory_wrap function. The probe then fails to link
+ # because PL_memory_wrap and Perl_croak are unresolved. At some
+ # point we should fix this. -- Yves
+ flags="-DPERL_NO_INLINE_FUNCTIONS $probe_ccflags $warn $stdflags $opt"
case "$opt" in
*-pedantic*) flags="$flags -DPERL_GCC_PEDANTIC" ;;
esac
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 79804413f0..a7a3465148 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -287,6 +287,11 @@ L</Platform Support> section, instead.
=item *
+GCC configuration probes now work with C<-Werror> when detecting library
+functions, the size of C<long double>, and supported compiler options.
+
+=item *
+
Fix some build noise and technical undefined behaviour with
C<-Duselongdouble> builds on ARM64: