Reformat some long warning-flag-setting lines

This commit is contained in:
ISSOtm
2026-03-09 02:17:51 -04:00
committed by Rangi
parent dc5fc9f327
commit b56b56a695

View File

@@ -24,12 +24,13 @@ option(SANITIZERS "Build with sanitizers enabled" OFF)
cmake_dependent_option(MORE_WARNINGS "Turn on more warnings" OFF !MSVC OFF)
if(MSVC)
# MSVC's own standard library triggers warning C5105,
# "macro expansion producing 'defined' has undefined behavior".
# Warning C5030 is about unknown attributes (`[[gnu::ATTR]]`), none of ours being load-bearing.
# Warning C4996 is about using POSIX names, which we want to do for portability.
# We also opt into the C++20-conformant preprocessor.
add_compile_options(/MP /wd5105 /wd5030 /wd4996 /Zc:preprocessor)
add_compile_options(
/MP # Build multiple files in parallel.
/wd5105 # MSVC's own standard library triggers warning C5105, "macro expansion producing 'defined' has undefined behavior".
/wd5030 # Warning C5030 is about unknown attributes (`[[gnu::ATTR]]`), none of ours being load-bearing.
/wd4996 # Warning C4996 is about using POSIX names, which we want to do for portability.
/Zc:preprocessor # Opt into the C++20-conformant preprocessor.
)
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
if(SANITIZERS)
@@ -39,12 +40,10 @@ if(MSVC)
add_link_options(${SAN_FLAGS})
endif()
else()
add_compile_options(-Wall -pedantic)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# C++20 allows macros to take zero variadic arguments, but Clang (aka AppleClang on macOS)
# does not recognize this yet.
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)
endif()
add_compile_options(-Wall -pedantic
# C++20 allows macros to take zero variadic arguments.
# Some versions of Clang don't recognize this, and treat them as a GNU extension.
-Wno-gnu-zero-variadic-macro-arguments)
if(SANITIZERS)
message(STATUS "ASan and UBSan enabled")
set(SAN_FLAGS -fsanitize=address -fsanitize=undefined