From c07e705c48a509898b8e1744eb0db3cf86508c86 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 23 Sep 2017 03:17:29 +0000 Subject: [PATCH] Update fallthrough__ definitions. git-svn-id: https://svn.eduke32.com/eduke32@6447 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/compat.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index 84cd37779..fefba2832 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -226,16 +226,23 @@ # define CONSTEXPR_CXX14 #endif -#if __has_cpp_attribute(fallthrough) -# define fallthrough__ [[fallthrough]] -#elif __has_cpp_attribute(clang::fallthrough) -# define fallthrough__ [[clang::fallthrough]] -#elif __has_cpp_attribute(gnu::fallthrough) -# define fallthrough__ [[gnu::fallthrough]] -#elif defined _MSC_VER -# define fallthrough__ __fallthrough -#else -# define fallthrough__ +#ifdef __cplusplus +# if __has_cpp_attribute(fallthrough) +# define fallthrough__ [[fallthrough]] +# elif __has_cpp_attribute(clang::fallthrough) +# define fallthrough__ [[clang::fallthrough]] +# elif __has_cpp_attribute(gnu::fallthrough) +# define fallthrough__ [[gnu::fallthrough]] +# endif +#endif +#ifndef fallthrough__ +# if !defined __clang__ && EDUKE32_GCC_PREREQ(7,0) +# define fallthrough__ __attribute__((fallthrough)) +# elif defined _MSC_VER +# define fallthrough__ __fallthrough +# else +# define fallthrough__ +# endif #endif