Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
0b2683d1
Commit
0b2683d1
authored
Jul 27, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not insert implicit "return;" in empty function body
R=ken OCL=32239 CL=32239
parent
b388d840
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
3 deletions
+15
-3
dcl.c
src/cmd/gc/dcl.c
+1
-1
go.y
src/cmd/gc/go.y
+1
-1
bug043.go
test/fixedbugs/bug043.go
+1
-1
bug080.go
test/fixedbugs/bug080.go
+2
-0
bug171.go
test/fixedbugs/bug171.go
+10
-0
No files found.
src/cmd/gc/dcl.c
View file @
0b2683d1
...
...
@@ -636,7 +636,7 @@ funclit1(Node *ntype, NodeList *body)
n
->
nname
=
f
;
n
->
type
=
ft
;
if
(
body
==
nil
)
body
=
list1
(
nod
(
O
RETURN
,
N
,
N
));
body
=
list1
(
nod
(
O
EMPTY
,
N
,
N
));
n
->
nbody
=
body
;
compile
(
n
);
funcdepth
--
;
...
...
src/cmd/gc/go.y
View file @
0b2683d1
...
...
@@ -1196,7 +1196,7 @@ fnbody:
{
$$ = $2;
if($$ == nil)
$$ = list1(nod(O
RETURN
, N, N));
$$ = list1(nod(O
EMPTY
, N, N));
yyoptsemi(0);
}
...
...
test/fixedbugs/bug043.go
View file @
0b2683d1
...
...
@@ -18,6 +18,6 @@ func g (x int) float ; // BUG this doesn't
func
g
(
x
int
)
float
{
return
0.0
}
func
h
(
x
int
)
(
u
int
,
v
int
)
;
// BUG this doesn't
func
h
(
x
int
)
(
u
int
,
v
int
)
{}
func
h
(
x
int
)
(
u
int
,
v
int
)
{
return
;
}
func
main
()
{}
test/fixedbugs/bug080.go
View file @
0b2683d1
...
...
@@ -7,9 +7,11 @@
package
main
func
f1
()
(
x
int
,
y
float
)
{
return
;
}
func
f2
(
x
int
,
y
float
)
{
return
;
}
func
main
()
{
...
...
test/fixedbugs/bug171.go
0 → 100644
View file @
0b2683d1
// errchk $G $D/$F.go
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
main
func
f
()
int
{
}
// ERROR "return"
func
g
()
(
foo
int
)
{
}
// ERROR "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