[Scummvm-git-logs] scummvm master -> 6ec1b6d73e3b0e30f7df5e44cbf7c986cc6812a2
dwatteau
noreply at scummvm.org
Thu Oct 16 20:07:31 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:
6ec1b6d73e BAGEL: Silence GCC/Clang warnings if compiler has no -Wcast-function-type
Commit: 6ec1b6d73e3b0e30f7df5e44cbf7c986cc6812a2
https://github.com/scummvm/scummvm/commit/6ec1b6d73e3b0e30f7df5e44cbf7c986cc6812a2
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-10-16T22:06:16+02:00
Commit Message:
BAGEL: Silence GCC/Clang warnings if compiler has no -Wcast-function-type
e.g. the PS3 builder, which is based on GCC 7.5.0, would complain a lot
about the `GCC diagnostic ignored` pragma.
It seems that this warning was added in GCC 8.1. For Clang, it's always
harder to figure out when a feature was added, but there is a
`__has_warning` helper for this.
Unfortunately, `__has_warning` is a bit picky, and should NOT be used
in a single preprocessor statement, along with other evaluations (see
https://reviews.llvm.org/D101288 as another example of this).
Changed paths:
engines/bagel/mfc/afxwin.h
diff --git a/engines/bagel/mfc/afxwin.h b/engines/bagel/mfc/afxwin.h
index 737617e4022..b5102e0791d 100644
--- a/engines/bagel/mfc/afxwin.h
+++ b/engines/bagel/mfc/afxwin.h
@@ -324,15 +324,25 @@ typedef void (AFX_MSG_CALL CCmdTarget:: *AFX_PMSG)();
* With C++20, it may be possible to use the MessageMapFunctions enum and
* avoid casting by using a designated initializer.
*/
-#ifdef __GNUC__
-#define BEGIN_SILENCE_CAST \
+// (Using *distinct* `#if` calls below is necessary for proper parsing)
+#if defined(__clang__) && defined(__has_warning)
+# if __has_warning("-Wcast-function-type")
+# define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1
+# endif
+#elif GCC_ATLEAST(8, 1)
+# define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1
+#endif
+
+#ifdef COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING
+# define BEGIN_SILENCE_CAST \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
-#define END_SILENCE_CAST \
+# define END_SILENCE_CAST \
_Pragma("GCC diagnostic pop")
+# undef COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING
#else
-#define BEGIN_SILENCE_CAST
-#define END_SILENCE_CAST
+# define BEGIN_SILENCE_CAST
+# define END_SILENCE_CAST
#endif
#define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass) \
More information about the Scummvm-git-logs
mailing list