Skip to content

Commit 5df6e8a

Browse files
authored
[CMake][NFC] Disable mismatched-new-delete warning in GCC (#19)
The warning triggers for the overloads for operator new/delete in BumpAllocator, because the BumpAllocator class is templated with the SlabSize. GCC does select the correct overload of operator new/delete, but produces a warning. Since we build with -Wall -Werror this results in a compile error. We are in the process of reporting this to GCC, but for now let's disable the warning.
1 parent 6944a8a commit 5df6e8a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ else ()
5252
# We often add unreachable() to default cases
5353
add_compile_options(-Wno-covered-switch-default)
5454
add_compile_options(-Wsign-compare)
55+
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
56+
# Operator new/delete overloads with templated arguments trigger this. This is likely a bug in GCC.
57+
# GCC does the right thing but emits a warning.
58+
# Bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123513
59+
# Since we compile with -Wall -Werror we need to disable this warning for now.
60+
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-mismatched-new-delete>)
5561
endif ()
5662

5763
check_linker_flag(CXX "LINKER:--gc-sections" HAVE_GC_SECTIONS)

0 commit comments

Comments
 (0)