Enable warnings for implicit fallthroughs.

These would have flagged on https://github.com/google/iree/pull/2266.

Closes https://github.com/google/iree/pull/2294

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/2294 from ScottTodd:fallthrough-warnings 72f68fa4cc7de8f8efa1968324233bff7b5cdae0
PiperOrigin-RevId: 317933479
diff --git a/.bazelrc b/.bazelrc
index 3487c50..3e61b35 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -29,7 +29,7 @@
 test --test_output=errors
 
 ###############################################################################
-# Options for "generic_clang" builds: these options should generally apply to 
+# Options for "generic_clang" builds: these options should generally apply to
 # either clang or gcc and are curated based on need.
 ###############################################################################
 
@@ -43,6 +43,9 @@
 build:generic_clang --copt=-Wno-invalid-offsetof
 build:generic_clang --copt=-Wno-unused-function
 
+# Enable warnings we do care about.
+build:generic_clang --copt=-Wimplicit-fallthrough
+
 # C++14 standard version is required.
 build:generic_clang --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
 
diff --git a/build_tools/cmake/iree_copts.cmake b/build_tools/cmake/iree_copts.cmake
index cec163a..4453be7 100644
--- a/build_tools/cmake/iree_copts.cmake
+++ b/build_tools/cmake/iree_copts.cmake
@@ -42,6 +42,8 @@
     "-Wno-gnu-label-as-value"
     "-Wno-unused-local-typedef"
     "-Wno-gnu-zero-variadic-macro-arguments"
+    # Enable some warnings
+    "-Wimplicit-fallthrough"
   CLANG_OR_GCC
     "-Wno-unused-parameter"
     "-Wno-undef"