From c87bdcb229597f4b8a2109641ee4d01ab1ef7484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Heusipp?= Date: Thu, 26 Dec 2024 19:14:51 +0000 Subject: [PATCH] [Fix] mpt/base/source_location.hpp: Work-around missing std::source_location builtins in older Apple Clang versions. See . git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22609 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- src/mpt/base/source_location.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mpt/base/source_location.hpp b/src/mpt/base/source_location.hpp index 90be04bc77a..2a1333f5802 100644 --- a/src/mpt/base/source_location.hpp +++ b/src/mpt/base/source_location.hpp @@ -41,7 +41,11 @@ using std::source_location; #define MPT_SOURCE_LOCATION_LINE __builtin_LINE() #define MPT_SOURCE_LOCATION_COLUMN 0 -#elif MPT_COMPILER_CLANG && MPT_CLANG_AT_LEAST(9, 0, 0) +#elif MPT_COMPILER_CLANG && ((!MPT_OS_MACOSX_OR_IOS && MPT_CLANG_AT_LEAST(9, 0, 0)) || (MPT_OS_MACOSX_OR_IOS && MPT_CLANG_AT_LEAST(12, 0, 0))) + +// We do not know which Apple Clang version introduced __builtin_FILE(). +// It fails with 10.x (see ), +// and IRC dicussion decided on 12.x as a somewhat safe choice. #define MPT_SOURCE_LOCATION_FILE __builtin_FILE() #define MPT_SOURCE_LOCATION_FUNCTION __builtin_FUNCTION()