Update mapping between Apple Clang versions and upstream Clang

We can not trust __clang_major__ and __clang_minor__ for Apple Clang,
but we still want a single Q_CC_CLANG define that can be used to check
the Clang version.

Pick-to: 6.3 6.2
Fixes: QTBUG-99020
Change-Id: I5128c1ff40d1ef1afeaab3c7fa4988a5bb170742
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
bb10
Tor Arne Vestbø 2022-03-18 18:00:14 +01:00
parent 60c70e4eff
commit a1d74b0618
1 changed files with 20 additions and 20 deletions

View File

@ -156,29 +156,29 @@
# elif defined(__clang__)
/* Clang also masquerades as GCC */
# if defined(__apple_build_version__)
# /* http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions */
# if __apple_build_version__ >= 8020041
# define Q_CC_CLANG 309
# elif __apple_build_version__ >= 8000038
# define Q_CC_CLANG 308
# elif __apple_build_version__ >= 7000053
# define Q_CC_CLANG 306
# elif __apple_build_version__ >= 6000051
# define Q_CC_CLANG 305
# elif __apple_build_version__ >= 5030038
# define Q_CC_CLANG 304
# elif __apple_build_version__ >= 5000275
# define Q_CC_CLANG 303
# elif __apple_build_version__ >= 4250024
# define Q_CC_CLANG 302
# elif __apple_build_version__ >= 3180045
# define Q_CC_CLANG 301
# elif __apple_build_version__ >= 2111001
# define Q_CC_CLANG 300
// The Clang version reported by Apple Clang in __clang_major__
// and __clang_minor__ does _not_ reflect the actual upstream
// version of the compiler. To allow consumers to use a single
// define to verify the Clang version we hard-code the versions
// based on the best available info we have about the actual
// version: http://en.wikipedia.org/wiki/Xcode#Toolchain_Versions
# if __apple_build_version__ >= 13160021 // Xcode 13.3
# define Q_CC_CLANG 1300
# elif __apple_build_version__ >= 13000029 // Xcode 13.0
# define Q_CC_CLANG 1200
# elif __apple_build_version__ >= 12050022 // Xcode 12.5
# define Q_CC_CLANG 1110
# elif __apple_build_version__ >= 12000032 // Xcode 12.0
# define Q_CC_CLANG 1000
# elif __apple_build_version__ >= 11030032 // Xcode 11.4
# define Q_CC_CLANG 900
# elif __apple_build_version__ >= 11000033 // Xcode 11.0
# define Q_CC_CLANG 800
# else
# error "Unknown Apple Clang version"
# error "Unsupported Apple Clang version"
# endif
# else
// Non-Apple Clang, so we trust the versions reported
# define Q_CC_CLANG ((__clang_major__ * 100) + __clang_minor__)
# endif
# if __has_builtin(__builtin_assume)