From ed3cb888985d95be8967f41f9e604f280fcc9496 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 3 Jan 2022 01:28:12 -0700 Subject: [PATCH] Meta: Enable -Wexpansion-to-defined warning for Clang The Clang implementation of this warning protects against some undefined pre-processor behavior while ignoring function-like macros. The gcc implementation also warns on function-like macros, and is therefore noisy. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46b40d157b4..751ef111056 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,6 @@ add_compile_options(-Wno-address-of-packed-member) add_compile_options(-Wcast-qual) add_compile_options(-Wdeprecated-copy) add_compile_options(-Wduplicated-cond) -add_compile_options(-Wno-expansion-to-defined) add_compile_options(-Wformat=2) add_compile_options(-Wimplicit-fallthrough) add_compile_options(-Wlogical-op) @@ -191,6 +190,8 @@ add_compile_options(-g1) if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") add_compile_options(-Wno-literal-suffix) add_compile_options(-Wno-maybe-uninitialized) + # Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros + add_compile_options(-Wno-expansion-to-defined) add_compile_options(-Wcast-align) add_compile_options(-Wdouble-promotion) elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")