From 11444a4e3a2c1f760f6ab790dd099f76e273b2eb Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Tue, 3 Apr 2018 10:46:37 +0200 Subject: [PATCH] Updates to macros --- include/CLI/Macros.hpp | 19 ++++++++++++++++--- include/CLI/Option.hpp | 5 ++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/CLI/Macros.hpp b/include/CLI/Macros.hpp index a7949a2..21d584e 100644 --- a/include/CLI/Macros.hpp +++ b/include/CLI/Macros.hpp @@ -9,21 +9,34 @@ namespace CLI { // The following version macro is very similar to the one in PyBind11 -#if !defined(_MSC_VER) && !defined(__INTEL_COMPILER) +#if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER) #if __cplusplus >= 201402L #define CLI11_CPP14 -#if __cplusplus > 201402L /* Temporary: should be updated to >= the final C++17 value once known */ +#if __cplusplus >= 201703L #define CLI11_CPP17 +#if __cplusplus > 201703L +#define CLI11_CPP20 #endif #endif -#elif defined(_MSC_VER) +#endif +#elif defined(_MSC_VER) && __cplusplus == 199711L // MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully implemented) +// Unless you use the /Zc:__cplusplus flag on Visual Studio 2017 15.7 Preview 3 or newer #if _MSVC_LANG >= 201402L #define CLI11_CPP14 #if _MSVC_LANG > 201402L && _MSC_VER >= 1910 #define CLI11_CPP17 +#if __MSVC_LANG > 201703L && _MSC_VER >= 1910 +#define CLI11_CPP20 +#endif #endif #endif #endif +#if defined(PYBIND11_CPP14) +#define CLI11_DEPRECATED(reason) [[deprecated(reason)]] +#else +#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason))) +#endif + } // namespace CLI diff --git a/include/CLI/Option.hpp b/include/CLI/Option.hpp index 3039135..9b8ea03 100644 --- a/include/CLI/Option.hpp +++ b/include/CLI/Option.hpp @@ -300,14 +300,17 @@ class Option : public OptionBase