From fc2ce286c3cc430d0b0136dec2df4081f1414e4d Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 11 Sep 2018 13:29:39 +0200 Subject: [PATCH] Only use the alignment built-in functions if they exist (i.e. GCC > 4.6) --- src/align.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/align.h b/src/align.h index 6d329ae798..24ff0828b0 100644 --- a/src/align.h +++ b/src/align.h @@ -44,6 +44,8 @@ * alignment. * * Note that this turns into a no-op but gives information to the compiler. + * For GCC versions older than 4.6 this is ignored as the builtin does not + * exist. * * @param type The type of the array. * @param array The array. @@ -52,11 +54,11 @@ #if defined(__ICC) #define swift_align_information(type, array, alignment) \ __assume_aligned(array, alignment); -#elif defined(__GNUC__) +#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > 6) #define swift_align_information(type, array, alignment) \ array = (type *)__builtin_assume_aligned(array, alignment); #else -#define swift_align_information(array, alignment) ; +#define swift_align_information(type, array, alignment) ; #endif /** -- GitLab