Import Tint changes from Dawn
Changes:
- 7bd151a780126e54de1ca00e9c1ab73dedf96e59 tint: use TINT_BUILD_IS_MAC instead of __APPLE__ by Antonio Maiorano <amaiorano@google.com>
- 16901fbcdfe3b58e568cf0315846c192fd31135a tint: fix mac build wrt 'reserved-id-macro' warning by Antonio Maiorano <amaiorano@google.com>
GitOrigin-RevId: 7bd151a780126e54de1ca00e9c1ab73dedf96e59
Change-Id: I3a0ce3cf53052cd8479a07b9e68ae63b8a20fb30
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/178520
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/cmd/remote_compile/main.cc b/src/tint/cmd/remote_compile/main.cc
index 726f986..277450e 100644
--- a/src/tint/cmd/remote_compile/main.cc
+++ b/src/tint/cmd/remote_compile/main.cc
@@ -448,7 +448,7 @@
}
return;
}
-#if TINT_BUILD_MSL_WRITER && defined(__APPLE__)
+#if TINT_BUILD_MSL_WRITER && TINT_BUILD_IS_MAC
if (req.language == SourceLanguage::MSL) {
auto version = tint::msl::validate::MslVersion::kMsl_1_2;
if (req.version_major == 2 && req.version_minor == 1) {
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index 06f2ef0..7ea3010 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -932,7 +932,7 @@
if (options.validate && options.skip_hash.count(hash) == 0) {
tint::msl::validate::Result res;
-#ifdef __APPLE__
+#if TINT_BUILD_IS_MAC
res = tint::msl::validate::ValidateUsingMetal(result->msl, msl_version);
#else
#ifdef _WIN32
@@ -948,7 +948,7 @@
res.output = "xcrun executable not found. Cannot validate.";
res.failed = true;
}
-#endif // __APPLE__
+#endif // TINT_BUILD_IS_MAC
if (res.failed) {
std::cerr << res.output << "\n";
return false;
diff --git a/src/tint/lang/msl/validate/validate.h b/src/tint/lang/msl/validate/validate.h
index 1a303d5..d7b8acf 100644
--- a/src/tint/lang/msl/validate/validate.h
+++ b/src/tint/lang/msl/validate/validate.h
@@ -69,14 +69,14 @@
/// @return the result of the compile
Result Validate(const std::string& xcrun_path, const std::string& source, MslVersion version);
-#ifdef __APPLE__
+#if TINT_BUILD_IS_MAC
/// ValidateUsingMetal attempts to compile the shader with the runtime Metal Shader Compiler
/// API, verifying that the shader compiles successfully.
/// @param source the generated MSL source
/// @param version the version of MSL to validate against
/// @return the result of the compile
Result ValidateUsingMetal(const std::string& source, MslVersion version);
-#endif // __APPLE__
+#endif // TINT_BUILD_IS_MAC
} // namespace tint::msl::validate
diff --git a/src/tint/utils/macros/compiler.h b/src/tint/utils/macros/compiler.h
index dd56cde..a3de76f 100644
--- a/src/tint/utils/macros/compiler.h
+++ b/src/tint/utils/macros/compiler.h
@@ -88,8 +88,9 @@
#define TINT_DISABLE_WARNING_DEPRECATED /* currently no-op */
#define TINT_DISABLE_WARNING_RESERVED_IDENTIFIER \
_Pragma("clang diagnostic ignored \"-Wreserved-identifier\"")
-#define TINT_DISABLE_WARNING_RESERVED_MACRO_IDENTIFIER \
- _Pragma("clang diagnostic ignored \"-Wreserved-macro-identifier\"")
+#define TINT_DISABLE_WARNING_RESERVED_MACRO_IDENTIFIER \
+ _Pragma("clang diagnostic ignored \"-Wreserved-macro-identifier\"") \
+ _Pragma("clang diagnostic ignored \"-Wreserved-id-macro\"")
#define TINT_DISABLE_WARNING_UNUSED_VALUE _Pragma("clang diagnostic ignored \"-Wunused-value\"")
#define TINT_DISABLE_WARNING_UNUSED_PARAMETER \
_Pragma("clang diagnostic ignored \"-Wunused-parameter\"")