Skip to content

Commit 303026b

Browse files
authored
Don't drop -DNDEBUG from CMAKE_CXX_FLAGS_RELEASE (swiftlang#33565)
* Don't drop -DNDEBUG from CMAKE_CXX_FLAGS_RELEASE * Add comment
1 parent 61e93c5 commit 303026b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,10 @@ endif()
635635

636636
if(NOT SWIFT_COMPILER_IS_MSVC_LIKE)
637637
# CMake's default for CMAKE_CXX_FLAGS_RELEASE is "-O3 -DNDEBUG". Let's avoid "-O3" for consistency
638-
# between Release and RelWithDebInfo. And let's not set -DNDEBUG because we're setting that manually
639-
# based on LLVM_ENABLE_ASSERTIONS.
640-
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
638+
# between Release and RelWithDebInfo. Dropping -DNDEBUG from this setting is blocked by triggering
639+
# a test failure of Swift-Unit :: Syntax/./SwiftSyntaxTests/TypeSyntaxTests.MetatypeTypeWithAPIs
640+
# because unit tests don't currently explicitly set -DNDEBUG/-UNDEBUG.
641+
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
641642

642643
_compute_lto_flag("${SWIFT_TOOLS_ENABLE_LTO}" _lto_flag_out)
643644
if(_lto_flag_out)

0 commit comments

Comments
 (0)