mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00: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:
parent
a624786333
commit
a27f55e819
10
ssh.h
10
ssh.h
@ -512,7 +512,7 @@ void SHATransform(word32 * digest, word32 * data);
|
||||
#ifdef _FORCE_SHA_NI
|
||||
# define COMPILER_SUPPORTS_SHA_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(<shaintrin.h>) && (defined(__x86_64__) || defined(__i386))
|
||||
# define COMPILER_SUPPORTS_SHA_NI
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
@ -529,14 +529,6 @@ void SHATransform(word32 * digest, word32 * data);
|
||||
# undef COMPILER_SUPPORTS_SHA_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_SHA_NI
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int random_byte(void);
|
||||
void random_add_noise(void *noise, int length);
|
||||
void random_add_heavynoise(void *noise, int length);
|
||||
|
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
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user