2
0
mirror of https://github.com/boostorg/spirit.git synced 2026-01-19 04:42:11 +00:00

X3: Improve C++17 diagnostic

This commit is contained in:
Nikita Kniazev
2022-01-09 18:39:33 +03:00
parent 9168be80dd
commit 5498bc0fd1

View File

@@ -24,17 +24,31 @@
# define BOOST_SPIRIT_X3_STRINGIZE(x) BOOST_SPIRIT_X3_STRINGIZE_IMPL(x)
# if defined __GNUC__ || defined __clang__
# warning "Spirit X3 will soon use C++17 features which your compiler does not support"
# if (defined __clang__ && __clang_major__ >= 4 || __GNUC__ >= 7) && __cplusplus < 201703L
# warning "Use -std=c++17 or -std=gnu++17 compiler flag to enable C++17 mode"
# endif
# warning "Minimal supported compiler versions: Clang 4 / GCC 7 / MSC 1915 (VS 2017 v15.8)"
# if defined __clang__
# pragma message "This compiler seems to be Clang " BOOST_SPIRIT_X3_STRINGIZE(__clang_major__)
# pragma message "This compiler seems to be Clang " BOOST_SPIRIT_X3_STRINGIZE(__clang_major__) " (__cplusplus=" BOOST_SPIRIT_X3_STRINGIZE(__cplusplus) ")"
# else
# pragma message "This compiler seems to be GCC " BOOST_SPIRIT_X3_STRINGIZE(__GNUC__)
# pragma message "This compiler seems to be GCC " BOOST_SPIRIT_X3_STRINGIZE(__GNUC__) " (__cplusplus=" BOOST_SPIRIT_X3_STRINGIZE(__cplusplus) ")"
# endif
# warning "Define BOOST_SPIRIT_X3_HIDE_CXX17_WARNING to hide the warning"
# elif defined _MSC_VER
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: Spirit X3 will soon use C++17 features which your compiler does not support" )
# ifdef _MSVC_LANG
# if _MSC_VER >= 1915 && _MSVC_LANG < 201703L
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: Use /std:c++17 compiler flag to enable C++17 mode" )
# endif
# define BOOST_SPIRIT_X3_TMP "_MSVC_LANG=" BOOST_SPIRIT_X3_STRINGIZE(_MSVC_LANG)
# elif defined _HAS_CXX17
# define BOOST_SPIRIT_X3_TMP "_HAS_CXX17 defined"
# else
# define BOOST_SPIRIT_X3_TMP "__cplusplus=" BOOST_SPIRIT_X3_STRINGIZE(__cplusplus)
# endif
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: Minimal supported compiler versions: Clang 4 / GCC 7 / MSC 1915 (VS 2017 v15.8)" )
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: This compiler seems to be MSC " BOOST_SPIRIT_X3_STRINGIZE(_MSC_VER) )
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: This compiler seems to be MSC " BOOST_SPIRIT_X3_STRINGIZE(_MSC_VER) " (" BOOST_SPIRIT_X3_TMP ")" )
# undef BOOST_SPIRIT_X3_TMP
# pragma message (__FILE__ "(" BOOST_SPIRIT_X3_STRINGIZE(__LINE__) "): warning: Define BOOST_SPIRIT_X3_HIDE_CXX17_WARNING to hide the warning" )
# else
# pragma message "warning: Spirit X3 will soon use C++17 features which your compiler does not support"