From d846a9f7919a4ba19f66430e3d5c72b110d0945f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 18 Aug 2022 19:36:31 +0200 Subject: [PATCH] Don't use token-pasting with non-identifiers in msvc/wx/setup.h This used to work with the non-standard preprocessor in the older MSVC versions, but doesn't work with the new standard-compliant one in MSVS 2022 (enabled by /Zc:preprocessor). Luckily, it seems that we don't really need it neither, as simply expanding the macros in a /-separated strings work with both the new and the old preprocessors and has the same effect, so just do this instead. Also simplify the code a little by defining wxTOOLKIT_FULL and constructing wxSETUPH_PATH once instead of twice. See #22654, #22680. Co-Authored-By: Vadim Zeitlin (cherry picked from commit a12a2f12827e4784aa894ebbfe15e4bbab28407b) --- docs/changes.txt | 4 ++++ include/msvc/wx/setup.h | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index caaf1007a2..44fb7ec6dd 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -250,6 +250,10 @@ wxGTK: - Improve linking with OpenGL libraries in CMake build (Maarten Bent, #22649). - Fix new warnings from gcc 12.1. +wxMSW: + +- Fix build with MSVC when using standard preprocessor (k3DW, #22654). + wxOSX: - Fix missing key and kill focus events for wxSearchCtrl (#19321, #22702). diff --git a/include/msvc/wx/setup.h b/include/msvc/wx/setup.h index 5a2f6e2434..cd7f2ca0d7 100644 --- a/include/msvc/wx/setup.h +++ b/include/msvc/wx/setup.h @@ -127,15 +127,15 @@ #endif #endif // wxTOOLKIT_PREFIX +#ifdef wxSUFFIX + #define wxTOOLKIT_FULL wxCONCAT(wxTOOLKIT_PREFIX, wxSUFFIX) +#else // suffix is empty + #define wxTOOLKIT_FULL wxTOOLKIT_PREFIX +#endif + // the real setup.h header file we need is in the build-specific directory, // construct the path to it -#ifdef wxSUFFIX - #define wxSETUPH_PATH \ - wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h) -#else // suffix is empty - #define wxSETUPH_PATH \ - wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h) -#endif +#define wxSETUPH_PATH ../../../lib/wxLIB_SUBDIR/wxTOOLKIT_FULL/wx/setup.h #define wxSETUPH_PATH_STR wxSTRINGIZE(wxSETUPH_PATH)