Emit deprecation warnings for @stage.

This PR enables the deprecation warnings for the @stage builtin.

Bug: tint:1503
Change-Id: I4a560f451a9ad56bc712f6a04c18eba6ae67ab64
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93121
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/docs/tint/origin-trial-changes.md b/docs/tint/origin-trial-changes.md
index 55758ae..85a12ef 100644
--- a/docs/tint/origin-trial-changes.md
+++ b/docs/tint/origin-trial-changes.md
@@ -1,5 +1,16 @@
 # Tint changes during Origin Trial
 
+## Changes for M105
+
+### Deprecated Features
+
+* The `@stage` attribute has been deprecated. The short forms should be used
+  instead (`@vertex`, `@fragment`, or `@compute`). [tint:1503](crbug.com/tint/1503)
+
+## Changes for M104
+
+* Parsing of `@compute`, `@fragment` and `@vertex` added.
+
 ## Changes for M103
 
 ### New features
diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc
index a28b798..7fd1a81 100644
--- a/src/tint/reader/wgsl/parser_impl.cc
+++ b/src/tint/reader/wgsl/parser_impl.cc
@@ -3251,6 +3251,7 @@
         });
     }
 
+    // TODO(crbug.com/tint/1503): Remove when deprecation period is over.
     if (t == kStageAttribute) {
         return expect_paren_block("stage attribute", [&]() -> Result {
             auto stage = expect_pipeline_stage();
@@ -3258,26 +3259,22 @@
                 return Failure::kErrored;
             }
 
-            // TODO(crbug.com/tint/1503): Enable this once all the Dawn and CTS
-            // tests are updated to use the new format so we can avoid spamming
-            // the log files.
-            if ((false)) {
-                std::string warning = "stage should use @";
-                switch (stage.value) {
-                    case ast::PipelineStage::kVertex:
-                        warning += "vertex";
-                        break;
-                    case ast::PipelineStage::kFragment:
-                        warning += "fragment";
-                        break;
-                    case ast::PipelineStage::kCompute:
-                        warning += "compute";
-                        break;
-                    case ast::PipelineStage::kNone:
-                        break;
-                }
-                deprecated(t.source(), warning);
+            std::string warning = "remove stage and use @";
+            switch (stage.value) {
+                case ast::PipelineStage::kVertex:
+                    warning += "vertex";
+                    break;
+                case ast::PipelineStage::kFragment:
+                    warning += "fragment";
+                    break;
+                case ast::PipelineStage::kCompute:
+                    warning += "compute";
+                    break;
+                case ast::PipelineStage::kNone:
+                    break;
             }
+            deprecated(t.source(), warning);
+
             return create<ast::StageAttribute>(t.source(), stage.value);
         });
     }
diff --git a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc
index ab97d94..972e118 100644
--- a/src/tint/reader/wgsl/parser_impl_error_msg_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_error_msg_test.cc
@@ -316,8 +316,13 @@
 }
 
 TEST_F(ParserImplErrorTest, FunctionDeclStageMissingRParen) {
-    EXPECT("@stage(vertex fn f() {}",
-           R"(test.wgsl:1:15 error: expected ')' for stage attribute
+    EXPECT(
+        "@stage(vertex fn f() {}",
+        R"(test.wgsl:1:2 warning: use of deprecated language feature: remove stage and use @vertex
+@stage(vertex fn f() {}
+ ^^^^^
+
+test.wgsl:1:15 error: expected ')' for stage attribute
 @stage(vertex fn f() {}
               ^^
 )");
diff --git a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
index 44f3d78..a32e140 100644
--- a/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
+++ b/src/tint/reader/wgsl/parser_impl_function_attribute_test.cc
@@ -263,7 +263,8 @@
     EXPECT_TRUE(attr.errored);
     EXPECT_EQ(attr.value, nullptr);
     EXPECT_TRUE(p->has_error());
-    EXPECT_EQ(p->error(), "1:14: expected ')' for stage attribute");
+    EXPECT_EQ(p->error(), R"(1:1: use of deprecated language feature: remove stage and use @compute
+1:14: expected ')' for stage attribute)");
 }
 
 TEST_F(ParserImplTest, Attribute_Compute) {