[gcc] Add missing *_UNREACHABLEs
to prevent -Wreturn-type warnings.

Also removed other unsupported gcc flags which caused
'cc1plus: note: unrecognized command-line option' warnings.

Bug: 511288390
Change-Id: I28d3e7586472728e635c716bf2fedc797e0fce1c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/310015
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/cmake/DawnCompilerExtraFlags.cmake b/src/cmake/DawnCompilerExtraFlags.cmake
index caaf850..c37bbf3 100644
--- a/src/cmake/DawnCompilerExtraFlags.cmake
+++ b/src/cmake/DawnCompilerExtraFlags.cmake
@@ -42,13 +42,21 @@
 ################################################################################
 function(common_compile_options target)
   if (COMPILER_IS_LIKE_GNU)
+    if (COMPILER_IS_CLANG)
+      target_compile_options(${target}
+        PRIVATE
+          "-Wno-assume"
+          "-Wno-deprecated-builtins"
+          "-Wno-unknown-warning-option"
+      )
+    elseif (COMPILER_IS_GNU)
+      if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
+        target_compile_options(${target} PRIVATE "-Wno-sfinae-incomplete")
+      endif ()
+    endif ()
     target_compile_options(${target}
       PRIVATE
         "-fno-exceptions"
-
-        "-Wno-assume"
-        "-Wno-deprecated-builtins"
-        "-Wno-unknown-warning-option"
         "-Wno-switch-default"
         "-Wno-nrvo"
     )
@@ -76,11 +84,16 @@
   if (NOT MSVC)
     get_target_property(deps ${target} LINK_LIBRARIES)
     if (deps MATCHES "absl")
+      if (COMPILER_IS_CLANG)
+        target_compile_options(${target}
+          PRIVATE
+            "-Wno-gcc-compat"
+            "-Wno-unreachable-code-break"
+            "-Wno-nullability-extension"
+        )
+      endif ()
       target_compile_options(${target} PUBLIC
-              "-Wno-gcc-compat"
-              "-Wno-unreachable-code-break"
-              "-Wno-nullability-extension"
-              "-Wno-shadow"
+        "-Wno-shadow"
       )
     endif ()
   endif ()
diff --git a/src/dawn/native/vulkan/TextureVk.cpp b/src/dawn/native/vulkan/TextureVk.cpp
index 955e75a..8d14866 100644
--- a/src/dawn/native/vulkan/TextureVk.cpp
+++ b/src/dawn/native/vulkan/TextureVk.cpp
@@ -413,6 +413,7 @@
         case wgpu::ComponentSwizzle::Undefined:
             DAWN_UNREACHABLE();
     }
+    DAWN_UNREACHABLE();
 }
 
 void MaybeConvertDepthStencilSwizzleOneToAlpha(bool isDepthOrStencilFormat,
diff --git a/src/dawn/native/vulkan/UtilsVulkan.cpp b/src/dawn/native/vulkan/UtilsVulkan.cpp
index 35fd2c9..4829cb8 100644
--- a/src/dawn/native/vulkan/UtilsVulkan.cpp
+++ b/src/dawn/native/vulkan/UtilsVulkan.cpp
@@ -177,6 +177,7 @@
             DAWN_UNREACHABLE();
             return VK_ATTACHMENT_LOAD_OP_DONT_CARE;
     }
+    DAWN_UNREACHABLE();
 }
 
 VkAttachmentStoreOp VulkanAttachmentStoreOp(wgpu::StoreOp op) {
@@ -191,6 +192,7 @@
             DAWN_UNREACHABLE();
             return VK_ATTACHMENT_STORE_OP_DONT_CARE;
     }
+    DAWN_UNREACHABLE();
 }
 
 // Vulkan SPEC requires the source/destination region specified by each element of
diff --git a/src/tint/lang/core/type/resource_type.cc b/src/tint/lang/core/type/resource_type.cc
index ae6d13b..abdf1ea 100644
--- a/src/tint/lang/core/type/resource_type.cc
+++ b/src/tint/lang/core/type/resource_type.cc
@@ -182,6 +182,7 @@
                 case core::type::TextureDimension::kNone:
                     TINT_UNREACHABLE();
             }
+            TINT_UNREACHABLE();
         },
         [&](const core::type::MultisampledTexture* ms) {
             return tint::Switch(
@@ -279,6 +280,7 @@
                 case core::type::TextureDimension::kNone:
                     TINT_UNREACHABLE();
             }
+            TINT_UNREACHABLE();
         },
         [&](const core::type::MultisampledTexture* ms) {
             return tint::Switch(
diff --git a/src/tint/lang/wgsl/ast/builder.cc b/src/tint/lang/wgsl/ast/builder.cc
index 6e80281..52443a5 100644
--- a/src/tint/lang/wgsl/ast/builder.cc
+++ b/src/tint/lang/wgsl/ast/builder.cc
@@ -631,6 +631,7 @@
         case core::SubgroupMatrixKind::kUndefined:
             TINT_UNREACHABLE();
     }
+    TINT_UNREACHABLE();
 }
 
 ast::Type Builder::TypesBuilder::buffer(uint32_t size) const {