mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
compat.h: Add macros so that we can use constexpr without breaking C++ < 11 and C.
git-svn-id: https://svn.eduke32.com/eduke32@6115 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
1ebbd553bd
commit
b98b00281c
1 changed files with 13 additions and 1 deletions
|
@ -190,6 +190,18 @@
|
|||
# define ASMSYM(x) x
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus && (__cplusplus >= 201103L || __has_feature(cxx_constexpr))
|
||||
# define HAVE_CONSTEXPR
|
||||
# define CONSTEXPR constexpr
|
||||
#else
|
||||
# define CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if CXXSTD >= 2014
|
||||
# define CONSTEXPR_CXX14 CONSTEXPR
|
||||
#else
|
||||
# define CONSTEXPR_CXX14
|
||||
#endif
|
||||
|
||||
////////// Platform detection //////////
|
||||
|
||||
|
@ -663,7 +675,7 @@ EDUKE32_STATIC_ASSERT(sizeof(vec3d_t) == sizeof(double) * 3);
|
|||
|
||||
#if defined _MSC_VER
|
||||
# define ARRAY_SIZE(arr) _countof(arr)
|
||||
#elif defined __cplusplus && (__cplusplus >= 201103L || __has_feature(cxx_constexpr))
|
||||
#elif defined HAVE_CONSTEXPR
|
||||
template <typename T, size_t N>
|
||||
static FORCE_INLINE constexpr size_t ARRAY_SIZE(T const (&)[N]) noexcept
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue