mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Move definitions of safenew, PROHIBITED, _DEBUG into CMake
This commit is contained in:
parent
f2b53c82eb
commit
229b82a502
@ -208,6 +208,19 @@ endmacro()
|
|||||||
function( audacity_append_common_compiler_options var )
|
function( audacity_append_common_compiler_options var )
|
||||||
list( APPEND ${var}
|
list( APPEND ${var}
|
||||||
PRIVATE
|
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:MSVC>:/permissive->
|
||||||
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-underaligned-exception-object>
|
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Wno-underaligned-exception-object>
|
||||||
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Werror=return-type>
|
$<$<CXX_COMPILER_ID:AppleClang,Clang>:-Werror=return-type>
|
||||||
@ -217,7 +230,11 @@ function( audacity_append_common_compiler_options var )
|
|||||||
-DWXINTL_NO_GETTEXT_MACRO
|
-DWXINTL_NO_GETTEXT_MACRO
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:-D_USE_MATH_DEFINES>
|
$<$<CXX_COMPILER_ID:MSVC>:-D_USE_MATH_DEFINES>
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:-DNOMINMAX>
|
$<$<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 )
|
set( ${var} "${${var}}" PARENT_SCOPE )
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@ -113,20 +113,4 @@ class wxWindow;
|
|||||||
#include "configwin.h"
|
#include "configwin.h"
|
||||||
#endif
|
#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__
|
#endif // __AUDACITY_H__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user