This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add -Wthread-safety for clang 3.5 or later
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 22 Nov 2015 16:40:36 +0000 (11:40 -0500)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 23 Nov 2015 11:55:12 +0000 (06:55 -0500)
With this change there is no need to explicitly e.g.
Configure ... -Accflags='-Wthread-safety'
since doing just -Dusethreads with recent enough clang
will automatically add the -Wthread-safety

cflags.SH

index ec70ed2..2aee426 100755 (executable)
--- a/cflags.SH
+++ b/cflags.SH
@@ -378,6 +378,29 @@ do
   esac
 done
 
+# If usethreads and clang, add -Wthread-safety for clang 3.5 or later.
+# gccversion is defined also for clang, because compat, use that for matching.
+# Apple overwrites clang version with XCode version.
+# Aggressively forward-proofing.
+case "$usethreads" in
+define)
+case "$gccversion" in
+*" Clang 3."[56789]*|*" Clang "[456]*|*"Apple LLVM "[6789]*)
+  for f in -Wthread-safety
+  do
+    case " $warn " in
+    *" $f "*) ;; # Skip if already there.
+    *)
+      echo "cflags.SH: Adding $f because usethreads and clang and gccversion '$gccversion'"
+      warn="$warn $f"
+      ;;
+    esac
+  done
+;;
+esac
+;;
+esac
+
 echo "cflags.SH: cc       = $cc"
 echo "cflags.SH: ccflags  = $ccflags"
 echo "cflags.SH: stdflags = $stdflags"