mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Use correct way to detect new instructions in Clang
__clang_major__ and __clang_minor__ macros may be overriden in Apple and other compilers. Instead of them, we use __has_attribute(target) to check whether Clang supports per-function targeted build and __has_include() to check if there are intrinsic header files
This commit is contained in:

committed by
Simon Tatham

parent
a624786333
commit
a27f55e819
10
sshaes.c
10
sshaes.c
@ -1134,7 +1134,7 @@ const struct ssh2_ciphers ssh2_aes = {
|
||||
#ifdef _FORCE_AES_NI
|
||||
# define COMPILER_SUPPORTS_AES_NI
|
||||
#elif defined(__clang__)
|
||||
# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)) && (defined(__x86_64__) || defined(__i386))
|
||||
# if __has_attribute(target) && __has_include(<wmmintrin.h>) && (defined(__x86_64__) || defined(__i386))
|
||||
# define COMPILER_SUPPORTS_AES_NI
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
@ -1151,14 +1151,6 @@ const struct ssh2_ciphers ssh2_aes = {
|
||||
# undef COMPILER_SUPPORTS_AES_NI
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
# if !__has_attribute(target)
|
||||
/* If clang is old enough not to support __attribute__((target(...)))
|
||||
* as used below, then we can't use this code after all. */
|
||||
# undef COMPILER_SUPPORTS_AES_NI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPILER_SUPPORTS_AES_NI
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user