mirror of
				https://github.com/cookiengineer/audacity
				synced 2025-10-26 15:23:48 +01:00 
			
		
		
		
	Make _ force crash in debug build, if used in static initializer
This commit is contained in:
		| @@ -29,7 +29,16 @@ extern const wxString& GetCustomSubstitution(const wxString& str1 ); | |||||||
| // Marks strings for extraction only...must use wxGetTranslation() to translate. | // Marks strings for extraction only...must use wxGetTranslation() to translate. | ||||||
| #define XO(s)  wxT(s) | #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 | // The two string arugments will go to the .pot file, as | ||||||
| // msgid sing | // msgid sing | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user