Import Tint changes from Dawn

Changes:
  - 13d14525c4f69c457a6f32b22c93057e45c4852d Fix builds that disable tint_build_spv_reader by Brandon Jones <bajones@chromium.org>
  - 61d2cf297a4b13958d7e2321abe1178e710375ea Making SPIR-V ingestion and validation optional by Brandon Jones <bajones@chromium.org>
  - f1fc8c8bc7ebaf78fff03578ba240f1690b0092a tint: Remove commented out includes by Ben Clayton <bclayton@google.com>
GitOrigin-RevId: 13d14525c4f69c457a6f32b22c93057e45c4852d
Change-Id: I0a2bce8a30325ae9fc572999ac020abf63d3f862
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/117520
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index f3fd25b..941fc83 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -1024,12 +1024,19 @@
     } else {
       sources = [ "test_main.cc" ]
       configs += [ ":tint_unittests_config" ]
-      deps += [
-        ":libtint",
-        ":tint_unittests_hlsl_writer_src",
-        ":tint_unittests_msl_writer_src",
-        ":tint_unittests_spv_reader_src",
-      ]
+      deps += [ ":libtint" ]
+
+      if (tint_build_hlsl_writer) {
+        deps += [ ":tint_unittests_hlsl_writer_src" ]
+      }
+
+      if (tint_build_msl_writer) {
+        deps += [ ":tint_unittests_msl_writer_src" ]
+      }
+
+      if (tint_build_spv_reader) {
+        deps += [ ":tint_unittests_spv_reader_src" ]
+      }
     }
   }
 
diff --git a/src/tint/fuzzers/tint_common_fuzzer.cc b/src/tint/fuzzers/tint_common_fuzzer.cc
index 15ab7d8..11cdf76 100644
--- a/src/tint/fuzzers/tint_common_fuzzer.cc
+++ b/src/tint/fuzzers/tint_common_fuzzer.cc
@@ -149,8 +149,8 @@
 #endif
 
     switch (input_) {
-#if TINT_BUILD_WGSL_READER
         case InputFormat::kWGSL: {
+#if TINT_BUILD_WGSL_READER
             // Clear any existing diagnostics, as these will hold pointers to file_,
             // which we are about to release.
             diagnostics_ = {};
@@ -160,11 +160,12 @@
                 dump_input_data(str, ".wgsl");
             }
             program = reader::wgsl::Parse(file_.get());
+#endif  // TINT_BUILD_WGSL_READER
             break;
         }
-#endif  // TINT_BUILD_WGSL_READER
-#if TINT_BUILD_SPV_READER
+
         case InputFormat::kSpv: {
+#if TINT_BUILD_SPV_READER
             // `spirv_input` has been initialized with the capacity to store `size /
             // sizeof(uint32_t)` uint32_t values. If `size` is not a multiple of
             // sizeof(uint32_t) then not all of `data` can be copied into
@@ -177,9 +178,9 @@
                 dump_input_data(spirv_input, ".spv");
             }
             program = reader::spirv::Parse(spirv_input);
+#endif  // TINT_BUILD_SPV_READER
             break;
         }
-#endif  // TINT_BUILD_SPV_READER
     }
 
     if (!program.IsValid()) {
diff --git a/src/tint/reader/spirv/parser_impl.h b/src/tint/reader/spirv/parser_impl.h
index 9ff9033..7713734 100644
--- a/src/tint/reader/spirv/parser_impl.h
+++ b/src/tint/reader/spirv/parser_impl.h
@@ -25,7 +25,6 @@
 #include "src/tint/utils/compiler_macros.h"
 #include "src/tint/utils/hashmap.h"
 
-#if TINT_BUILD_SPV_READER
 TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF);
 TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST);
 TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION);
@@ -35,7 +34,6 @@
 TINT_END_DISABLE_WARNING(SIGN_CONVERSION);
 TINT_END_DISABLE_WARNING(OLD_STYLE_CAST);
 TINT_END_DISABLE_WARNING(NEWLINE_EOF);
-#endif
 
 #include "src/tint/program_builder.h"
 #include "src/tint/reader/reader.h"
diff --git a/src/tint/reader/spirv/parser_impl_test_helper.h b/src/tint/reader/spirv/parser_impl_test_helper.h
index d1b0e35..ea0e37e 100644
--- a/src/tint/reader/spirv/parser_impl_test_helper.h
+++ b/src/tint/reader/spirv/parser_impl_test_helper.h
@@ -23,7 +23,6 @@
 
 #include "src/tint/utils/compiler_macros.h"
 
-#if TINT_BUILD_SPV_READER
 TINT_BEGIN_DISABLE_WARNING(NEWLINE_EOF);
 TINT_BEGIN_DISABLE_WARNING(OLD_STYLE_CAST);
 TINT_BEGIN_DISABLE_WARNING(SIGN_CONVERSION);
@@ -33,7 +32,6 @@
 TINT_END_DISABLE_WARNING(SIGN_CONVERSION);
 TINT_END_DISABLE_WARNING(OLD_STYLE_CAST);
 TINT_END_DISABLE_WARNING(NEWLINE_EOF);
-#endif
 
 #include "gtest/gtest.h"
 #include "src/tint/demangler.h"
diff --git a/src/tint/transform/texture_1d_to_2d_test.cc b/src/tint/transform/texture_1d_to_2d_test.cc
index 687988c..5a2cd18 100644
--- a/src/tint/transform/texture_1d_to_2d_test.cc
+++ b/src/tint/transform/texture_1d_to_2d_test.cc
@@ -13,10 +13,6 @@
 // limitations under the License.
 
 #include "src/tint/transform/texture_1d_to_2d.h"
-
-// #include <memory>
-// #include <utility>
-
 #include "src/tint/transform/test_helper.h"
 
 namespace tint::transform {