From 19b54766a3893b964b75c3d74be6b75d47e58ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 31 May 2019 19:20:13 -0700 Subject: [PATCH] Added C++ standard name. --- include/bx/macros.h | 4 ++-- include/bx/platform.h | 15 +++++++++++++++ tests/run_test.cpp | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/bx/macros.h b/include/bx/macros.h index 1509925..2f92c1f 100644 --- a/include/bx/macros.h +++ b/include/bx/macros.h @@ -115,11 +115,11 @@ /// The return value of the function is solely a function of the arguments. /// -#if (BX_COMPILER_MSVC && (BX_COMPILER_MSVC <= 1900)) || (BX_COMPILER_GCC && (__cplusplus < 201402L)) +#if __cplusplus < 201402 # define BX_CONSTEXPR_FUNC BX_CONST_FUNC #else # define BX_CONSTEXPR_FUNC constexpr BX_CONST_FUNC -#endif // BX_COMPILER_MSVC && (BX_COMPILER_MSVC <= 1900) +#endif // __cplusplus < 201402 /// #define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__) diff --git a/include/bx/platform.h b/include/bx/platform.h index bf41b86..f70d0c2 100644 --- a/include/bx/platform.h +++ b/include/bx/platform.h @@ -426,4 +426,19 @@ # define BX_ARCH_NAME "64-bit" #endif // BX_ARCH_ +#if defined(__cplusplus) +# if __cplusplus < 201103L +# error "Pre-C++11 compiler is not supported!" +# elif __cplusplus < 201402L +# define BX_CPP_NAME "C++11" +# elif __cplusplus < 201703L +# define BX_CPP_NAME "C++14" +# elif __cplusplus < 201704L +# define BX_CPP_NAME "C++17" +# else +// See: https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b#orthodox-c +# define BX_CPP_NAME "C++WayTooModern" +# endif // BX_CPP_NAME +#endif // defined(__cplusplus) + #endif // BX_PLATFORM_H_HEADER_GUARD diff --git a/tests/run_test.cpp b/tests/run_test.cpp index 3fc0c10..1f7e050 100644 --- a/tests/run_test.cpp +++ b/tests/run_test.cpp @@ -15,6 +15,7 @@ int runAllTests(int _argc, const char* _argv[]) ", CRT: " BX_CRT_NAME ", Date: " __DATE__ ", Time: " __TIME__ + ", C++: " BX_CPP_NAME ); return Catch::Session().run(_argc, _argv); }