[Scummvm-git-logs] scummvm master -> 409200649464ff95a7a98370e7b1f405d8236a34

dwatteau noreply at scummvm.org
Fri Aug 23 22:43:28 UTC 2024


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

Summary:
4092006494 COMMON: Fix inttypes.h behavior on macOS 10.4


Commit: 409200649464ff95a7a98370e7b1f405d8236a34
    https://github.com/scummvm/scummvm/commit/409200649464ff95a7a98370e7b1f405d8236a34
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2024-08-24T00:42:47+02:00

Commit Message:
COMMON: Fix inttypes.h behavior on macOS 10.4

The macOS 10.4 SDK uses the non-standard (BSD) '%q' value, instead of
the more standard '%ll' value, triggering -Wformat warnings. This was
fixed in the 10.5 SDK, so borrow its fixes when targeting 10.4.

Also, __STDC_CONSTANT_MACROS is be necessary for OSX < 10.7.

Changed paths:
    common/scummsys.h


diff --git a/common/scummsys.h b/common/scummsys.h
index 453edc02b81..7066860f4cf 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -125,15 +125,25 @@
 	#include <ctype.h>
 
 	// The C++11 standard removed the C99 requirement that some <inttypes.h>
-	// features should only be available when the following macros are
-	// defined. But on some systems (such as RISC OS), the libc is not
-	// necessarily up to date with this change. So, continue defining them,
-	// in order to avoid build failures on some environments.
+	// features should only be available when the following macros are defined.
+	// But on some systems (such as RISC OS or macOS < 10.7), the system headers
+	// are not necessarily up to date with this change. So, continue defining
+	// them, in order to avoid build failures on some environments.
 	#define __STDC_CONSTANT_MACROS
 	#define __STDC_FORMAT_MACROS
 	#define __STDC_LIMIT_MACROS
 	#include <inttypes.h>
 
+	// macOS 10.4 inttypes.h woes -- fixed in 10.5 SDK
+	#if defined(MACOSX) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050
+		#undef __PRI_8_LENGTH_MODIFIER__
+		#undef __PRI_64_LENGTH_MODIFIER__
+		#undef __SCN_64_LENGTH_MODIFIER__
+		#define __PRI_8_LENGTH_MODIFIER__ "hh"
+		#define __PRI_64_LENGTH_MODIFIER__ "ll"
+		#define __SCN_64_LENGTH_MODIFIER__ "ll"
+	#endif
+
 	#include <limits.h>
 	// MSVC does not define M_PI, M_SQRT2 and other math defines by default.
 	// _USE_MATH_DEFINES must be defined in order to have these defined, thus




More information about the Scummvm-git-logs mailing list