1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-30 15:39:27 +02:00

Make a dynamic check of misuse of _ that works in Windows too...

see commit f57fdc99d7a1cd0cf4aa5818382b6b0ffcd2fa83
This commit is contained in:
Paul Licameli 2018-01-09 16:31:39 -05:00
parent acbfa1387e
commit 01718da4a2

View File

@ -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 <signal.h>
#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 <signal.h>
// 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