From 01718da4a228a5a3bd63776576069821bfb2565a Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 9 Jan 2018 16:31:39 -0500 Subject: [PATCH] Make a dynamic check of misuse of _ that works in Windows too... see commit f57fdc99d7a1cd0cf4aa5818382b6b0ffcd2fa83 --- src/Internat.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Internat.h b/src/Internat.h index ce0a03709..7a57c117f 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -29,13 +29,24 @@ extern const wxString& GetCustomSubstitution(const wxString& str1 ); // Marks strings for extraction only...must use wxGetTranslation() to translate. #define XO(s) wxT(s) -#if defined( __WXDEBUG__ ) && !defined( _MSC_VER ) - #include +#if defined( __WXDEBUG__ ) // Force a crash if you misuse _ in a static initializer, so that translation // is looked up too early and not found. + + #ifdef _MSC_VER + + #define _(s) ((wxTranslations::Get() || (DebugBreak(), true)), \ + GetCustomTranslation((s))) + + #else + + #include // Raise a signal because it's even too early to use wxASSERT for this. #define _(s) ((wxTranslations::Get() || raise(SIGTRAP)), \ GetCustomTranslation((s))) + + #endif + #else #define _(s) GetCustomTranslation((s)) #endif