1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-04 14:19:30 +02:00

Make _ force crash in debug build, if used in static initializer

This commit is contained in:
Paul Licameli 2017-09-30 10:37:08 -04:00
parent c6696f1b49
commit 70167a80fe

View File

@ -29,7 +29,16 @@ extern const wxString& GetCustomSubstitution(const wxString& str1 );
// Marks strings for extraction only...must use wxGetTranslation() to translate.
#define XO(s) wxT(s)
#define _(s) GetCustomTranslation((s))
#ifdef __WXDEBUG__
#include <signal.h>
// Force a crash if you misuse _ in a static initializer, so that translation
// is looked up too early and not found.
// Raise a signal because it's even too early to use wxASSERT for this.
#define _(s) ((wxTranslations::Get() || raise(SIGTRAP)), \
GetCustomTranslation((s)))
#else
#define _(s) GetCustomTranslation((s))
#endif
// The two string arugments will go to the .pot file, as
// msgid sing