@cryptotaxi247 / netdata-1 / commits / 5d93e29bb

Add -Wno-builtin-macro-redefined to compiler flags. (#17209)

This silences warnings about macros that are provided by the preprocessor/compiler itself being redefined. This is needed to silence warnings about _FORTIFY_SOURCE being redefined, which are being generated as we prefer a more aggressive value for it than what most distros provide by default. Without this change, the build is really noisy on many systems, and also fails when run with `-Werror`. It is also required long-term to allow for reproducible builds without throwing errors, as they need to redefine a number of macros provided by the preprocessor at build time.

Austin S. Hemmelgarn committed Mar 21, 2024 at 09:38 UTC 5d93e29bb3cadbfdf1be7742810cba573f3a7163
1 file changed +2
CMakeLists.txt
+2
@@ -218,6 +218,8 @@ foreach(FLAG function-sections data-sections)
218 add_simple_extra_compiler_flag("${FLAG}" "-f${FLAG}" EXTRA_OPT)
219 endforeach()
220
221 +add_simple_extra_compiler_flag("-Wbuiltin-macro-redefined" "-Wno-builtin-macro-redefined" EXTRA_OPT)
222 +
223 foreach(RELTYP RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
224 foreach(L C CXX)
225 set(CMAKE_${L}_FLAGS_${RELTYP} "${CMAKE_${L}_FLAGS_${RELTYP}} ${EXTRA_HARDENING_C_FLAGS} ${EXTRA_OPT_C_FLAGS}")