Remove some macro usage from `tint`.
Remove the `*_WRITER_ONLY` macros from `tint` and just wrap the format
calls in the `#if #endif` blocks. This ends up being shorter then the
code need to setup and use the macros.
Change-Id: Ib969878eb0311eeb11c80bb9914aba29ca90fe45
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/216814
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/cmd/tint/main.cc b/src/tint/cmd/tint/main.cc
index a8173e5..5dff6a6 100644
--- a/src/tint/cmd/tint/main.cc
+++ b/src/tint/cmd/tint/main.cc
@@ -57,7 +57,6 @@
#include "src/tint/utils/diagnostic/formatter.h"
#include "src/tint/utils/macros/defer.h"
#include "src/tint/utils/text/string.h"
-#include "src/tint/utils/text/string_stream.h"
#include "src/tint/utils/text/styled_text.h"
#include "src/tint/utils/text/styled_text_printer.h"
@@ -101,42 +100,6 @@
#include "src/tint/lang/glsl/validate/validate.h"
#endif // TINT_BUILD_GLSL_VALIDATOR
-#if TINT_BUILD_WGSL_READER
-#define WGSL_READER_ONLY(x) x
-#else
-#define WGSL_READER_ONLY(x)
-#endif
-
-#if TINT_BUILD_SPV_WRITER
-#define SPV_WRITER_ONLY(x) x
-#else
-#define SPV_WRITER_ONLY(x)
-#endif
-
-#if TINT_BUILD_WGSL_WRITER
-#define WGSL_WRITER_ONLY(x) x
-#else
-#define WGSL_WRITER_ONLY(x)
-#endif
-
-#if TINT_BUILD_MSL_WRITER
-#define MSL_WRITER_ONLY(x) x
-#else
-#define MSL_WRITER_ONLY(x)
-#endif
-
-#if TINT_BUILD_HLSL_WRITER
-#define HLSL_WRITER_ONLY(x) x
-#else
-#define HLSL_WRITER_ONLY(x)
-#endif
-
-#if TINT_BUILD_GLSL_WRITER
-#define GLSL_WRITER_ONLY(x) x
-#else
-#define GLSL_WRITER_ONLY(x)
-#endif
-
namespace {
/// Prints the given hash value in a format string that the end-to-end test runner can parse.
@@ -266,14 +229,31 @@
EnumName(Format::kNone, "none"),
};
- SPV_WRITER_ONLY(format_enum_names.Emplace(Format::kSpirv, "spirv"));
- SPV_WRITER_ONLY(format_enum_names.Emplace(Format::kSpvAsm, "spvasm"));
- WGSL_WRITER_ONLY(format_enum_names.Emplace(Format::kWgsl, "wgsl"));
- MSL_WRITER_ONLY(format_enum_names.Emplace(Format::kMsl, "msl"));
- HLSL_WRITER_ONLY(format_enum_names.Emplace(Format::kHlsl, "hlsl"));
- HLSL_WRITER_ONLY(format_enum_names.Emplace(Format::kHlslFxc, "hlsl-fxc"));
- GLSL_WRITER_ONLY(format_enum_names.Emplace(Format::kGlsl, "glsl"));
- WGSL_READER_ONLY(format_enum_names.Emplace(Format::kIr, "ir"));
+#if TINT_BUILD_WGSL_WRITER
+ format_enum_names.Emplace(Format::kWgsl, "wgsl");
+#endif
+
+#if TINT_BUILD_WGSL_READER
+ format_enum_names.Emplace(Format::kIr, "ir");
+#endif
+
+#if TINT_BUILD_SPV_WRITER
+ format_enum_names.Emplace(Format::kSpirv, "spirv");
+ format_enum_names.Emplace(Format::kSpvAsm, "spvasm");
+#endif
+
+#if TINT_BUILD_MSL_WRITER
+ format_enum_names.Emplace(Format::kMsl, "msl");
+#endif
+
+#if TINT_BUILD_HLSL_WRITER
+ format_enum_names.Emplace(Format::kHlsl, "hlsl");
+ format_enum_names.Emplace(Format::kHlslFxc, "hlsl-fxc");
+#endif
+
+#if TINT_BUILD_GLSL_WRITER
+ format_enum_names.Emplace(Format::kGlsl, "glsl");
+#endif
OptionSet options;
auto& fmt = options.Add<EnumOption<Format>>("format",