This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Better error message for missing statement after label
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org, gofrontend-dev at googlegroups dot com
- Date: Tue, 31 Aug 2010 21:35:35 -0700
- Subject: [gccgo] Better error message for missing statement after label
This patch improves gccgo's error message and subsequent processing when
a statement is missing after a label. Committed to gccgo branch.
Ian
diff -r 5052eefabc12 go/parse.cc
--- a/go/parse.cc Tue Aug 31 20:07:09 2010 -0700
+++ b/go/parse.cc Tue Aug 31 21:34:26 2010 -0700
@@ -3072,6 +3072,14 @@
return;
}
+ if (!this->statement_may_start_here())
+ {
+ error_at(location, "missing statement after label");
+ this->unget_token(Token::make_operator_token(OPERATOR_SEMICOLON,
+ location));
+ return;
+ }
+
this->statement(label);
}