compat.h: Add preliminary FALLTHROUGH macro to support

git-svn-id: https://svn.eduke32.com/eduke32@6353 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2017-07-10 13:44:04 +00:00
parent 4252a60af9
commit 37b2a751b9

View file

@ -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__