Support |alignof|/|alignas| in GCC 4.7.

(Note that support for GCC 4.7 ends 2018-03-23.)

Change-Id: Ia2ac6a735c8177a2b3a13f16197ff918266bc1cb
Reviewed-on: https://boringssl-review.googlesource.com/24924
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Frederik Kriewitz 2018-01-17 13:39:52 +01:00 committed by Adam Langley
parent c7ef069ac9
commit 5ab5484044

View File

@ -116,7 +116,14 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#if !defined(__cplusplus) #if defined(__GNUC__) && \
(__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
// |alignas| and |alignof| were added in C11. GCC added support in version 4.8.
// Testing for __STDC_VERSION__/__cplusplus doesn't work because 4.7 already
// reports support for C11.
#define alignas(x) __attribute__ ((aligned (x)))
#define alignof(x) __alignof__ (x)
#elif !defined(__cplusplus)
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define alignas(x) __declspec(align(x)) #define alignas(x) __declspec(align(x))
#define alignof __alignof #define alignof __alignof