Enable -Wswitch-enum warnings

This compiler option enables warnings about switch statements on enums that
do not exhaustively list every value.  The default case does *not* squelch
the warning.

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
3 files changed, 13 insertions(+), 3 deletions(-)

M CMakeLists.txt
M tests/test_sexpr_eval.c
M urldecode.c
M CMakeLists.txt +2 -1
@@ 1,5 1,5 @@ 
 #
-# Copyright (c) 2016-2020 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+# Copyright (c) 2016-2020,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
 #
 # Permission is hereby granted, free of charge, to any person obtaining a copy
 # of this software and associated documentation files (the "Software"), to deal

          
@@ 39,6 39,7 @@ add_definitions(
 
 add_compile_options(
 	-Wall
+	-Wswitch-enum
 	-O2
 	-g
 	-std=gnu99

          
M tests/test_sexpr_eval.c +9 -1
@@ 1,5 1,5 @@ 
 /*
- * Copyright (c) 2016-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2016-2017,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

          
@@ 112,6 112,14 @@ static void test_int_op(char *opname, en
 		case VT_INT:
 			ASSERT3U(res->i, ==, expected);
 			break;
+		case VT_NULL:
+		case VT_STR:
+		case VT_SYM:
+		case VT_CHAR:
+		case VT_BLOB:
+		case VT_CONS:
+		case VT_ARRAY:
+		case VT_NVL:
 		default:
 			fail("unhandled val type %u", type);
 	}

          
M urldecode.c +2 -1
@@ 1,5 1,5 @@ 
 /*
- * Copyright (c) 2010-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2010-2017,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

          
@@ 97,6 97,7 @@ static inline int append_esc(struct stat
 			state->outoff++;
 			state->state = DS_COPY;
 			break;
+		case DS_COPY:
 		default:
 			panic("illegal state when appending an escape");
 	}