Check for builtin before using it

The check for __has_builtin being defined and using the __has_builtin() macro need to be on different lines, as when __has_builtin is not defined, using the __has_builtin() macro is an invalid preprocessor directive.
This commit is contained in:
Ned Loynd
2023-03-07 10:17:44 +11:00
parent bc8dc72739
commit f4c9ddf530

View File

@@ -32,9 +32,13 @@
# define CGLM_ALIGN_MAT CGLM_ALIGN(16)
#endif
#ifdef __GNUC__
# define CGLM_ASSUME_ALIGNED(expr, alignment) \
__builtin_assume_aligned((expr), (alignment))
#if defined(__has_builtin)
# if __has_builtin(__builtin_assume_aligned)
# define CGLM_ASSUME_ALIGNED(expr, alignment) \
__builtin_assume_aligned((expr), (alignment))
# else
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
# endif
#else
# define CGLM_ASSUME_ALIGNED(expr, alignment) (expr)
#endif