New switch idiom
All checks were successful
Tests / Clang total: 932, passed: 932
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc] total: 932, passed: 932
Tests / Release [gcc,aarch64] total: 931, passed: 931
Tests / Coverage total: 930, passed: 930
weaselab/conflict-set/pipeline/head This commit looks good

Add -Wswitch-enum -Werror=switch-enum to enforce that we explicitly
handle all cases, and add a default: __builtin_unreachable() to all
switches to make un-enumerated values UB
This commit is contained in:
2024-03-13 20:07:27 -07:00
parent c68f563017
commit a07c93ffff
2 changed files with 38 additions and 12 deletions

View File

@@ -22,7 +22,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
"MinSizeRel" "RelWithDebInfo")
endif()
add_compile_options(-fdata-sections -ffunction-sections -fstrict-enums)
add_compile_options(-fdata-sections -ffunction-sections -Wswitch-enum
-Werror=switch-enum)
# This is encouraged according to
# https://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq