From 8380f929882ce8a20fca275670e9c86b495d6113 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Sun, 6 Feb 2022 15:11:27 +0200 Subject: [PATCH] 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. --- include/wx/defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index 81098fc9b8..241b8991f0 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -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]]