From 1ca911ed380f4ac670f08f4b8f83c8cc7654f4bc Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Sat, 25 Apr 2020 02:36:27 -0500 Subject: [PATCH] Convert all __WXDEBUG__ tests to use new _DEBUG symbol This symbol is based on the NDEBUG symbol that's automatically defined by CMake. --- src/AboutDialog.cpp | 6 +++--- src/Audacity.h | 6 ++++++ src/AudacityApp.cpp | 2 +- src/Envelope.cpp | 2 +- src/Internat.h | 2 +- src/Menus.cpp | 4 ++-- src/commands/CommandManager.cpp | 4 ++-- src/commands/CommandManager.h | 2 +- src/import/ImportGStreamer.cpp | 2 +- src/prefs/BatchPrefs.cpp | 2 +- src/prefs/LibraryPrefs.cpp | 2 +- src/prefs/ThemePrefs.cpp | 4 ++-- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/AboutDialog.cpp b/src/AboutDialog.cpp index 0153c76e8..b6cd5fa8c 100644 --- a/src/AboutDialog.cpp +++ b/src/AboutDialog.cpp @@ -706,10 +706,10 @@ void AboutDialog::PopulateInformationPage( ShuttleGui & S ) AddBuildinfoRow(&informationStr, XO("Commit Id:"), REV_IDENT ); auto buildType = -#ifdef __WXDEBUG__ - XO("Debug build") +#ifdef _DEBUG + XO("Debug build (debug level %d)").Format(wxDEBUG_LEVEL); #else - XO("Release build") + XO("Release build (debug level %d)").Format(wxDEBUG_LEVEL); #endif ; if( (sizeof(void*) == 8) ) diff --git a/src/Audacity.h b/src/Audacity.h index 5138aa165..40a56561c 100644 --- a/src/Audacity.h +++ b/src/Audacity.h @@ -236,5 +236,11 @@ class wxWindow; #define RTL_WORKAROUND( pWnd ) #endif +// Define/undefine _DEBUG based on the (CMake provided) NDEBUG symbol +#if defined(NDEBUG) + #undef _DEBUG +#else + #define _DEBUG 1 +#endif #endif // __AUDACITY_H__ diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 223f82dd8..4abc5c898 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -1182,7 +1182,7 @@ bool AudacityApp::OnExceptionInMainLoop() AudacityApp::AudacityApp() { // Do not capture crashes in debug builds -#if !defined(__WXDEBUG__) +#if !defined(_DEBUG) #if defined(EXPERIMENTAL_CRASH_REPORT) #if defined(wxUSE_ON_FATAL_EXCEPTION) && wxUSE_ON_FATAL_EXCEPTION wxHandleFatalExceptions(); diff --git a/src/Envelope.cpp b/src/Envelope.cpp index 38bf56f8e..d1758d558 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -725,7 +725,7 @@ void Envelope::Cap( double sampleDur ) */ int Envelope::InsertOrReplaceRelative(double when, double value) { -#if defined(__WXDEBUG__) +#if defined(_DEBUG) // in debug builds, do a spot of argument checking if(when > mTrackLen + 0.0000001) { diff --git a/src/Internat.h b/src/Internat.h index e6d43aee0..821e135b0 100644 --- a/src/Internat.h +++ b/src/Internat.h @@ -38,7 +38,7 @@ extern AUDACITY_DLL_API const wxString& GetCustomSubstitution(const wxString& st #undef _ #endif -#if defined( __WXDEBUG__ ) +#if defined( _DEBUG ) // Force a crash if you misuse _ in a static initializer, so that translation // is looked up too early and not found. diff --git a/src/Menus.cpp b/src/Menus.cpp index ef3091d38..661b146c3 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -1220,7 +1220,7 @@ void MenuCreator::CreateMenusAndCommands(AudacityProject &project) mLastFlags = AlwaysEnabledFlag; -#if defined(__WXDEBUG__) +#if defined(_DEBUG) // c->CheckDups(); #endif } @@ -1277,7 +1277,7 @@ void MenuCreator::RebuildMenuBar(AudacityProject &project) // On OSX, we can't rebuild the menus while a modal dialog is being shown // since the enabled state for menus like Quit and Preference gets out of // sync with wxWidgets idea of what it should be. -#if defined(__WXMAC__) && defined(__WXDEBUG__) +#if defined(__WXMAC__) && defined(_DEBUG) { wxDialog *dlg = wxDynamicCast(wxGetTopLevelParent(wxWindow::FindFocus()), wxDialog); diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index a6edb1002..434f864a2 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -726,7 +726,7 @@ CommandListEntry *CommandManager::NewIdentifier(const CommandID & nameIn, CommandListEntry *entry = &*mCommandList.back(); mCommandNumericIDHash[entry->id] = entry; -#if defined(__WXDEBUG__) +#if defined(_DEBUG) prev = mCommandNameHash[entry->name]; if (prev) { // Under Linux it looks as if we may ask for a newID for the same command @@ -1476,7 +1476,7 @@ void CommandManager::SetCommandFlags(const CommandID &name, entry->flags = flags; } -#if defined(__WXDEBUG__) +#if defined(_DEBUG) void CommandManager::CheckDups() { int cnt = mCommandList.size(); diff --git a/src/commands/CommandManager.h b/src/commands/CommandManager.h index 83a205e87..6395ecf16 100644 --- a/src/commands/CommandManager.h +++ b/src/commands/CommandManager.h @@ -286,7 +286,7 @@ class AUDACITY_DLL_API CommandManager final bool GetEnabled(const CommandID &name); int GetNumberOfKeysRead() const; -#if defined(__WXDEBUG__) +#if defined(_DEBUG) void CheckDups(); #endif void RemoveDuplicateShortcuts(); diff --git a/src/import/ImportGStreamer.cpp b/src/import/ImportGStreamer.cpp index 20b34db48..b28c128bc 100644 --- a/src/import/ImportGStreamer.cpp +++ b/src/import/ImportGStreamer.cpp @@ -1177,7 +1177,7 @@ GStreamerImportFileHandle::ProcessBusMessage(bool & success) return cont; } -#if defined(__WXDEBUG__) +#if defined(_DEBUG) { GstString objname; if (msg->src != NULL) diff --git a/src/prefs/BatchPrefs.cpp b/src/prefs/BatchPrefs.cpp index 6a03afcfd..5cc728755 100644 --- a/src/prefs/BatchPrefs.cpp +++ b/src/prefs/BatchPrefs.cpp @@ -71,7 +71,7 @@ void BatchPrefs::PopulateOrExchange( ShuttleGui & S ) S.StartStatic( XO("Behaviors"),1 ); { -#ifdef __WXDEBUG__ +#ifdef _DEBUG S.TieCheckBox( XO("&Don't apply effects in batch mode"), {wxT("/Batch/Debug"), false}); #endif diff --git a/src/prefs/LibraryPrefs.cpp b/src/prefs/LibraryPrefs.cpp index fdb104169..3a1d58423 100644 --- a/src/prefs/LibraryPrefs.cpp +++ b/src/prefs/LibraryPrefs.cpp @@ -214,7 +214,7 @@ void LibraryPrefs::OnFFmpegFindButton(wxCommandEvent & WXUNUSED(event)) #ifdef USE_FFMPEG FFmpegLibs* FFmpegLibsPtr = PickFFmpegLibs(); bool showerrs = -#if defined(__WXDEBUG__) +#if defined(_DEBUG) true; #else false; diff --git a/src/prefs/ThemePrefs.cpp b/src/prefs/ThemePrefs.cpp index 45afbc2df..a65fc7377 100644 --- a/src/prefs/ThemePrefs.cpp +++ b/src/prefs/ThemePrefs.cpp @@ -116,7 +116,7 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S) "Themability is an experimental feature.\n\nTo try it out, click \"Save Theme Cache\" then find and modify the images and colors in\nImageCacheVxx.png using an image editor such as the Gimp.\n\nClick \"Load Theme Cache\" to load the changed images and colors back into Audacity.\n\n(Only the Transport Toolbar and the colors on the wavetrack are currently affected, even\nthough the image file shows other icons too.)") ); -#ifdef __WXDEBUG__ +#ifdef _DEBUG S.AddFixedText( Verbatim( "This is a debug version of Audacity, with an extra button, 'Output Sourcery'. This will save a\nC version of the image cache that can be compiled in as a default.") @@ -142,7 +142,7 @@ void ThemePrefs::PopulateOrExchange(ShuttleGui & S) // This next button is only provided in Debug mode. // It is for developers who are compiling Audacity themselves // and who wish to generate a NEW ThemeAsCeeCode.h and compile it in. -#ifdef __WXDEBUG__ +#ifdef _DEBUG S.Id(idSaveThemeAsCode).AddButton(Verbatim("Output Sourcery")); #endif