1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 23:29:41 +02:00

Move definitions of safenew, PROHIBITED, _DEBUG into CMake

This commit is contained in:
Paul Licameli 2021-05-08 07:31:58 -04:00 committed by Leland Lucius
parent f2b53c82eb
commit 229b82a502
2 changed files with 18 additions and 17 deletions

View File

@ -208,6 +208,19 @@ endmacro()
function( audacity_append_common_compiler_options var )
list( APPEND ${var}
PRIVATE
# This renames a good use of this C++ keyword that we don't need
# to review when hunting for leaks because of naked new and delete.
-DPROHIBITED==delete
# Reviewed, certified, non-leaky uses of NEW that immediately entrust
# their results to RAII objects.
# You may use it in NEW code when constructing a wxWindow subclass
# with non-NULL parent window.
# You may use it in NEW code when the NEW expression is the
# constructor argument for a standard smart
# pointer like std::unique_ptr or std::shared_ptr.
-Dsafenew=new
$<$<CXX_COMPILER_ID:MSVC>:/permissive->
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-underaligned-exception-object>
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Werror=return-type>
@ -217,7 +230,11 @@ function( audacity_append_common_compiler_options var )
-DWXINTL_NO_GETTEXT_MACRO
$<$<CXX_COMPILER_ID:MSVC>:-D_USE_MATH_DEFINES>
$<$<CXX_COMPILER_ID:MSVC>:-DNOMINMAX>
)
# Define/undefine _DEBUG
# Yes, -U to /U too as needed for Windows:
$<IF:$<CONFIG:Release>,-U_DEBUG,-D_DEBUG=1>
)
set( ${var} "${${var}}" PARENT_SCOPE )
endfunction()

View File

@ -113,20 +113,4 @@ class wxWindow;
#include "configwin.h"
#endif
// This renames a good use of this C++ keyword that we don't need to review when hunting for leaks.
#define PROHIBITED = delete
// Reviewed, certified, non-leaky uses of NEW that immediately entrust their results to RAII objects.
// You may use it in NEW code when constructing a wxWindow subclass with non-NULL parent window.
// You may use it in NEW code when the NEW expression is the constructor argument for a standard smart
// pointer like std::unique_ptr or std::shared_ptr.
#define safenew new
// Define/undefine _DEBUG based on the (CMake provided) NDEBUG symbol
#if defined(NDEBUG)
#undef _DEBUG
#else
#define _DEBUG 1
#endif
#endif // __AUDACITY_H__