mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +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
|
# define ASMSYM(x) x
|
||||||
#endif
|
#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 //////////
|
////////// Platform detection //////////
|
||||||
|
|
||||||
|
@ -663,7 +675,7 @@ EDUKE32_STATIC_ASSERT(sizeof(vec3d_t) == sizeof(double) * 3);
|
||||||
|
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
# define ARRAY_SIZE(arr) _countof(arr)
|
# 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>
|
template <typename T, size_t N>
|
||||||
static FORCE_INLINE constexpr size_t ARRAY_SIZE(T const (&)[N]) noexcept
|
static FORCE_INLINE constexpr size_t ARRAY_SIZE(T const (&)[N]) noexcept
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue