Use |alignas| for alignment. MSVC doesn't have stdalign.h and so doesn't support |alignas| in C code. Define |alignas(x)| as a synonym for |__decltype(align(x))| instead for it. This also fixes -Wcast-qual warnings in rsaz_exp.c. Change-Id: Ifce9031724cb93f5a4aa1f567e7af61b272df9d5 Reviewed-on: https://boringssl-review.googlesource.com/6924 Reviewed-by: Adam Langley <agl@google.com> Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/internal.h b/crypto/internal.h index bf45349..fe4ed73 100644 --- a/crypto/internal.h +++ b/crypto/internal.h
@@ -112,6 +112,15 @@ #include <openssl/ex_data.h> #include <openssl/thread.h> +#if defined(_MSC_VER) +#if !defined(__cplusplus) || _MSC_VER < 1900 +#define alignas(x) __declspec(align(x)) +#define alignof __alignof +#endif +#else +#include <stdalign.h> +#endif + #if defined(OPENSSL_NO_THREADS) #elif defined(OPENSSL_WINDOWS) #pragma warning(push, 3)