This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Go patch committed: Better error message for missing comma
- 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: Wed, 26 Sep 2012 22:41:52 -0700
- Subject: Go patch committed: Better error message for missing comma
This patch to the Go frontend gives a better error message for a missing
comma in a composite literal. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch.
Ian
diff -r f47f5449a663 go/parse.cc
--- a/go/parse.cc Mon Sep 24 15:20:45 2012 -0700
+++ b/go/parse.cc Wed Sep 26 22:21:36 2012 -0700
@@ -2723,7 +2723,11 @@
}
else
{
- error_at(this->location(), "expected %<,%> or %<}%>");
+ if (token->is_op(OPERATOR_SEMICOLON))
+ error_at(this->location(),
+ "need trailing comma before newline in composite literal");
+ else
+ error_at(this->location(), "expected %<,%> or %<}%>");
this->gogo_->mark_locals_used();
int depth = 0;