From 37b2a751b9401e1b831aa89b940836d0f829bb94 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 10 Jul 2017 13:44:04 +0000 Subject: [PATCH] compat.h: Add preliminary FALLTHROUGH macro to support git-svn-id: https://svn.eduke32.com/eduke32@6353 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/compat.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/build/include/compat.h b/source/build/include/compat.h index ff7869466..01e2876c6 100644 --- a/source/build/include/compat.h +++ b/source/build/include/compat.h @@ -30,6 +30,9 @@ #ifndef __has_extension # define __has_extension __has_feature // Compatibility with pre-3.0 compilers. #endif +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif #ifdef _MSC_VER # define EDUKE32_MSVC_PREREQ(major) ((major) <= (_MSC_VER)) @@ -223,6 +226,17 @@ # 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]] +#else +# define FALLTHROUGH +#endif + + ////////// Platform detection ////////// #if defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__