diff --git a/src/libAtomVM/CMakeLists.txt b/src/libAtomVM/CMakeLists.txt index 0aa1eba95f..60731eff0a 100644 --- a/src/libAtomVM/CMakeLists.txt +++ b/src/libAtomVM/CMakeLists.txt @@ -132,9 +132,9 @@ add_library(libAtomVM ${SOURCE_FILES} ${HEADER_FILES}) target_include_directories(libAtomVM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_features(libAtomVM PUBLIC c_std_11) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - target_compile_options(libAtomVM PUBLIC -Wall ${MAYBE_PEDANTIC_FLAG} ${MAYBE_WERROR_FLAG} -Wextra -ggdb -Werror=incompatible-pointer-types) + target_compile_options(libAtomVM PUBLIC -Wall ${MAYBE_PEDANTIC_FLAG} ${MAYBE_WERROR_FLAG} -Wextra -ggdb -Werror=incompatible-pointer-types -Wswitch-enum) elseif (CMAKE_C_COMPILER_ID MATCHES "Clang") - target_compile_options(libAtomVM PUBLIC -Wall ${MAYBE_PEDANTIC_FLAG} -Wno-gnu-zero-variadic-macro-arguments --extra-warnings -Werror=incompatible-pointer-types ${MAYBE_WERROR_FLAG} -g) + target_compile_options(libAtomVM PUBLIC -Wall ${MAYBE_PEDANTIC_FLAG} -Wno-gnu-zero-variadic-macro-arguments --extra-warnings -Werror=incompatible-pointer-types -Wswitch-enum ${MAYBE_WERROR_FLAG} -g) endif() if (ENABLE_REALLOC_GC) diff --git a/src/libAtomVM/term.c b/src/libAtomVM/term.c index 4b55b1df54..9fc3d29645 100644 --- a/src/libAtomVM/term.c +++ b/src/libAtomVM/term.c @@ -1024,6 +1024,11 @@ TermCompareResult term_compare(term t, term other, TermCompareOpts opts, GlobalC break; } } + case TERM_TYPE_INDEX_NIL: + // This cannot happen, since this branch is executed only when + // `type_t == type_other`, + // but we do `t == other` as the first thing, making this case unreachable. + case TERM_TYPE_INDEX_INVALID: default: UNREACHABLE(); }