Add new macro for standard library header inclusion
Newer standard library headers should only be included when the compiler is targetting that standard, otherwise some compilers (like MSVC) will warn that you are using a newer C++ include on an older version.
This commit is contained in:
parent
3dfb2a5ac1
commit
b8d3b37c9e
6 changed files with 30 additions and 14 deletions
|
|
@ -205,6 +205,15 @@
|
|||
#define wxCHECK_CXX_STD(ver) 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* C++ header checks
|
||||
*/
|
||||
#if defined(__has_include)
|
||||
#define wxHAS_CXX17_INCLUDE(header) (wxCHECK_CXX_STD(201703L) && __has_include(header))
|
||||
#else
|
||||
#define wxHAS_CXX17_INCLUDE(header) 0
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* check for native bool type and TRUE/FALSE constants */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -46,12 +46,10 @@
|
|||
#include <utility>
|
||||
|
||||
// Check if C++17 <string_view> is available
|
||||
#ifdef __has_include
|
||||
#if __has_include(<string_view>)
|
||||
#include <string_view>
|
||||
#ifdef __cpp_lib_string_view
|
||||
#define wxHAS_STD_STRING_VIEW
|
||||
#endif
|
||||
#if wxHAS_CXX17_INCLUDE(<string_view>)
|
||||
#include <string_view>
|
||||
#ifdef __cpp_lib_string_view
|
||||
#define wxHAS_STD_STRING_VIEW
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue