[tint] Emit placeholder symbols for all toolchains
These were emitted for MSVC to force a .lib file to be produced for header-only targets.
Do the same for non-MSVC to silence macOS ranlib warnings.
Change-Id: I87769d95a5f26552d0d3d5757069ffa0d166f5ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/147280
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/api/common/common.cc b/src/tint/api/common/common.cc
index 620401a..639dbdc 100644
--- a/src/tint/api/common/common.cc
+++ b/src/tint/api/common/common.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_api_common_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_api_common_symbol = 1;
diff --git a/src/tint/api/options/options.cc b/src/tint/api/options/options.cc
index 3d6e3fd..3000253 100644
--- a/src/tint/api/options/options.cc
+++ b/src/tint/api/options/options.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_api_options_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_api_options_symbol = 1;
diff --git a/src/tint/cmd/bench/benchmark.cc b/src/tint/cmd/bench/benchmark.cc
index 9b28d93..ad8658b 100644
--- a/src/tint/cmd/bench/benchmark.cc
+++ b/src/tint/cmd/bench/benchmark.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_cmd_bench_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_cmd_bench_symbol = 1;
diff --git a/src/tint/lang/spirv/reader/common/common.cc b/src/tint/lang/spirv/reader/common/common.cc
index 928b7f2..3047d0f 100644
--- a/src/tint/lang/spirv/reader/common/common.cc
+++ b/src/tint/lang/spirv/reader/common/common.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_lang_spirv_reader_common_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_lang_spirv_reader_common_symbol = 1;
diff --git a/src/tint/utils/containers/containers.cc b/src/tint/utils/containers/containers.cc
index 6b06bf2..20d72e8 100644
--- a/src/tint/utils/containers/containers.cc
+++ b/src/tint/utils/containers/containers.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_containers_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_containers_symbol = 1;
diff --git a/src/tint/utils/macros/macros.cc b/src/tint/utils/macros/macros.cc
index 7613f2e..6aba026 100644
--- a/src/tint/utils/macros/macros.cc
+++ b/src/tint/utils/macros/macros.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_reflection_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_reflection_symbol = 1;
diff --git a/src/tint/utils/math/math.cc b/src/tint/utils/math/math.cc
index 75b5c30..96fe095 100644
--- a/src/tint/utils/math/math.cc
+++ b/src/tint/utils/math/math.cc
@@ -14,9 +14,9 @@
#include "src/tint/utils/math/math.h"
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_math_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_math_symbol = 1;
diff --git a/src/tint/utils/memory/memory.cc b/src/tint/utils/memory/memory.cc
index df7ad36..b988358 100644
--- a/src/tint/utils/memory/memory.cc
+++ b/src/tint/utils/memory/memory.cc
@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_memory_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_memory_symbol = 1;
diff --git a/src/tint/utils/reflection/reflection.cc b/src/tint/utils/reflection/reflection.cc
index 5b05af2..ebf0efb 100644
--- a/src/tint/utils/reflection/reflection.cc
+++ b/src/tint/utils/reflection/reflection.cc
@@ -14,9 +14,9 @@
#include "src/tint/utils/reflection/reflection.h"
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_reflection_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_reflection_symbol = 1;
diff --git a/src/tint/utils/result/result.cc b/src/tint/utils/result/result.cc
index ce28850..add6f74 100644
--- a/src/tint/utils/result/result.cc
+++ b/src/tint/utils/result/result.cc
@@ -14,9 +14,9 @@
#include "src/tint/utils/result/result.h"
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_result_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_result_symbol = 1;
diff --git a/src/tint/utils/traits/traits.cc b/src/tint/utils/traits/traits.cc
index 2e1a4c9..d9aef04 100644
--- a/src/tint/utils/traits/traits.cc
+++ b/src/tint/utils/traits/traits.cc
@@ -14,9 +14,9 @@
#include "src/tint/utils/traits/traits.h"
-#if defined(_MSC_VER) && !defined(__clang__)
-
-// A placeholder symbol used to make MSVC emit a .lib for this lib target.
-int tint_utils_traits_symbol = 1;
-
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#endif
+
+// A placeholder symbol used to emit a symbol for this lib target.
+int tint_utils_traits_symbol = 1;