Use [[fallthrough]] for all MSVC versions accepting it

Since VS 2015 Update 3, the C++ standard targeted by the compiler can be
detected through _MSVC_LANG. This macro is like __cplusplus, but reflects the
actual standard understood by the compiler, unlike __cplusplus which by default
is left to an ancient value for compatibility.

Closes #22099.
This commit is contained in:
Lauri Nurmi 2022-02-06 15:11:27 +02:00 committed by Vadim Zeitlin
parent 25fec4aca9
commit 8380f92988

View file

@ -302,7 +302,7 @@ typedef short int WXTYPE;
/* wxFALLTHROUGH is used to notate explicit fallthroughs in switch statements */
#if __cplusplus >= 201703L
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
#define wxFALLTHROUGH [[fallthrough]]
#elif __cplusplus >= 201103L && defined(__has_warning) && WX_HAS_CLANG_FEATURE(cxx_attributes)
#define wxFALLTHROUGH [[clang::fallthrough]]