[Scummvm-git-logs] scummvm master -> 679092c9de8fc2f2b64a32fbd6791416b9bffd85

dwatteau noreply at scummvm.org
Thu Jul 24 11:35:23 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
679092c9de COMMON: BUILD: Improve `-fsanitize=alignment` detection to avoid false positives


Commit: 679092c9de8fc2f2b64a32fbd6791416b9bffd85
    https://github.com/scummvm/scummvm/commit/679092c9de8fc2f2b64a32fbd6791416b9bffd85
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-07-24T13:35:01+02:00

Commit Message:
COMMON: BUILD: Improve `-fsanitize=alignment` detection to avoid false positives

Recent compiler releases may have an `undefined_behavior_sanitizer`
feature flag reporting that `-fsanitize=alignment` is in use. (Note that
this flag is also part of UBSan builds, by default.)

So also look for this, and move the check out of the no-HAVE_CONFIG_H
case, so that more build configurations can detect it.

See earlier commit a46253647a8a171e3f5fd1c3c4785dcb21525e61.

Changed paths:
    common/scummsys.h


diff --git a/common/scummsys.h b/common/scummsys.h
index 397e46d91ef..8d15622313e 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -269,6 +269,15 @@
 //    - ...
 // ...
 
+//
+// If -fsanitize=alignment is in use (or UBSan enabled it), and the compiler
+// happens to report it, make sure SCUMM_NEED_ALIGNMENT is defined, in order
+// to avoid false positives. `alignment_sanitizer` may not be reported in
+// earlier releases though, so look for the UBSan flag in that case.
+//
+#if __has_feature(alignment_sanitizer) || __has_feature(undefined_behavior_sanitizer)
+	#define SCUMM_NEED_ALIGNMENT
+#endif
 
 //
 // By default we try to use pragma push/pop to ensure various structs we use
@@ -288,14 +297,6 @@
 //
 #if !defined(HAVE_CONFIG_H)
 
-	// If -fsanitize=undefined or -fsanitize=alignment is in use, and the
-	// compiler happens to report it, make sure SCUMM_NEED_ALIGNMENT is
-	// defined, in order to avoid false positives when not using the
-	// "configure" script to enable UBSan.
-	#if __has_feature(undefined_behavior_sanitizer)
-		#define SCUMM_NEED_ALIGNMENT
-	#endif
-
 	#if defined(__DC__) || \
 		  defined(__DS__) || \
 		  defined(__3DS__) || \




More information about the Scummvm-git-logs mailing list