Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
3742998d
Commit
3742998d
authored
Dec 12, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Better error messages for { on line after if/for/switch.
From-SVN: r205944
parent
ed6b1c92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
gcc/go/gofrontend/parse.cc
+22
-3
No files found.
gcc/go/gofrontend/parse.cc
View file @
3742998d
...
...
@@ -4287,6 +4287,16 @@ Parse::if_stat()
cond
=
this
->
expression
(
PRECEDENCE_NORMAL
,
false
,
false
,
NULL
,
NULL
);
}
// Check for the easy error of a newline before starting the block.
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_SEMICOLON
))
{
Location
semi_loc
=
this
->
location
();
if
(
this
->
advance_token
()
->
is_op
(
OPERATOR_LCURLY
))
error_at
(
semi_loc
,
"missing %<{%> after if clause"
);
// Otherwise we will get an error when we call this->block
// below.
}
this
->
gogo_
->
start_block
(
this
->
location
());
Location
end_loc
=
this
->
block
();
Block
*
then_block
=
this
->
gogo_
->
finish_block
(
end_loc
);
...
...
@@ -4431,7 +4441,7 @@ Parse::switch_stat(Label* label)
Location
token_loc
=
this
->
location
();
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_SEMICOLON
)
&&
this
->
advance_token
()
->
is_op
(
OPERATOR_LCURLY
))
error_at
(
token_loc
,
"
unexpected semicolon or newline before %<{%>
"
);
error_at
(
token_loc
,
"
missing %<{%> after switch clause
"
);
else
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_COLONEQ
))
{
error_at
(
token_loc
,
"invalid variable name"
);
...
...
@@ -5158,6 +5168,16 @@ Parse::for_stat(Label* label)
}
}
// Check for the easy error of a newline before starting the block.
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_SEMICOLON
))
{
Location
semi_loc
=
this
->
location
();
if
(
this
->
advance_token
()
->
is_op
(
OPERATOR_LCURLY
))
error_at
(
semi_loc
,
"missing %<{%> after for clause"
);
// Otherwise we will get an error when we call this->block
// below.
}
// Build the For_statement and note that it is the current target
// for break and continue statements.
...
...
@@ -5224,8 +5244,7 @@ Parse::for_clause(Expression** cond, Block** post)
*
cond
=
NULL
;
else
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_LCURLY
))
{
error_at
(
this
->
location
(),
"unexpected semicolon or newline before %<{%>"
);
error_at
(
this
->
location
(),
"missing %<{%> after for clause"
);
*
cond
=
NULL
;
*
post
=
NULL
;
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment