]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Testsuite: fix analyzer tests on Darwin
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 19 Aug 2023 21:22:06 +0000 (23:22 +0200)
committerIain Sandoe <iain@sandoe.co.uk>
Sat, 20 Apr 2024 14:46:24 +0000 (15:46 +0100)
On macOS, system headers redefine by default some macros (memcpy,
memmove, etc) to checked versions, which defeats the analyzer. We
want to turn this off.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042

gcc/testsuite/ChangeLog:

PR analyzer/104042
* gcc.dg/analyzer/analyzer.exp: Pass -D_FORTIFY_SOURCE=0 on Darwin.

(cherry picked from commit ce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce)

gcc/testsuite/gcc.dg/analyzer/analyzer.exp

index 15d979cd8b5f084966906367e9789c353964ca9d..333e840244318d8eef2cfea4105ea20626fb4b2f 100644 (file)
@@ -32,6 +32,14 @@ if [info exists DEFAULT_CFLAGS] then {
 # If a testcase doesn't have special options, use these.
 set DEFAULT_CFLAGS "-fanalyzer -Wanalyzer-too-complex -fanalyzer-call-summaries"
 
+if { [istarget "*-*-darwin*" ] } {
+  # On macOS, system headers redefine by default some macros (memcpy,
+  # memmove, etc) to checked versions, which defeats the analyzer. We
+  # want to turn this off.
+  # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104042
+  set DEFAULT_CFLAGS "$DEFAULT_CFLAGS -D_FORTIFY_SOURCE=0"
+}
+
 # Initialize `dg'.
 dg-init