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
9475cafa
Commit
9475cafa
authored
Apr 11, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: distinguish fatal compiler bug from error+exit
R=ken2 CC=golang-dev
https://golang.org/cl/902044
parent
fe782685
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
23 deletions
+49
-23
lex.c
src/cmd/gc/lex.c
+20
-11
obj.c
src/cmd/gc/obj.c
+5
-2
subr.c
src/cmd/gc/subr.c
+22
-8
typecheck.c
src/cmd/gc/typecheck.c
+2
-2
No files found.
src/cmd/gc/lex.c
View file @
9475cafa
...
...
@@ -110,8 +110,10 @@ main(int argc, char *argv[])
curio
.
infile
=
infile
;
curio
.
bin
=
Bopen
(
infile
,
OREAD
);
if
(
curio
.
bin
==
nil
)
fatal
(
"open %s: %r"
,
infile
);
if
(
curio
.
bin
==
nil
)
{
print
(
"open %s: %r
\n
"
,
infile
);
errorexit
();
}
curio
.
peekc
=
0
;
curio
.
peekc1
=
0
;
curio
.
nlsemi
=
0
;
...
...
@@ -300,8 +302,10 @@ importfile(Val *f, int line)
return
;
}
if
(
strlen
(
f
->
u
.
sval
->
s
)
!=
f
->
u
.
sval
->
len
)
fatal
(
"import path contains NUL"
);
if
(
strlen
(
f
->
u
.
sval
->
s
)
!=
f
->
u
.
sval
->
len
)
{
yyerror
(
"import path contains NUL"
);
errorexit
();
}
if
(
strcmp
(
f
->
u
.
sval
->
s
,
"unsafe"
)
==
0
)
{
importpkg
=
mkpkg
(
f
->
u
.
sval
);
...
...
@@ -317,20 +321,25 @@ importfile(Val *f, int line)
path
=
strlit
(
cleanbuf
);
}
if
(
!
findpkg
(
path
))
fatal
(
"can't find import: %Z"
,
f
->
u
.
sval
);
if
(
!
findpkg
(
path
))
{
yyerror
(
"can't find import: %Z"
,
f
->
u
.
sval
);
errorexit
();
}
importpkg
=
mkpkg
(
path
);
imp
=
Bopen
(
namebuf
,
OREAD
);
if
(
imp
==
nil
)
fatal
(
"can't open import: %Z"
,
f
->
u
.
sval
);
if
(
imp
==
nil
)
{
yyerror
(
"can't open import: %Z"
,
f
->
u
.
sval
);
errorexit
();
}
file
=
strdup
(
namebuf
);
len
=
strlen
(
namebuf
);
if
(
len
>
2
&&
namebuf
[
len
-
2
]
==
'.'
&&
namebuf
[
len
-
1
]
==
'a'
)
{
if
(
!
skiptopkgdef
(
imp
))
fatal
(
"import not package file: %s"
,
namebuf
);
if
(
!
skiptopkgdef
(
imp
))
{
yyerror
(
"import not package file: %s"
,
namebuf
);
errorexit
();
}
}
// assume files move (get installed)
...
...
src/cmd/gc/obj.c
View file @
9475cafa
...
...
@@ -12,8 +12,11 @@ void
dumpobj
(
void
)
{
bout
=
Bopen
(
outfile
,
OWRITE
);
if
(
bout
==
nil
)
fatal
(
"cant open %s"
,
outfile
);
if
(
bout
==
nil
)
{
flusherrors
();
print
(
"can't create %s: %r
\n
"
,
outfile
);
errorexit
();
}
Bprint
(
bout
,
"%s
\n
"
,
thestring
);
Bprint
(
bout
,
" exports automatically generated from
\n
"
);
...
...
src/cmd/gc/subr.c
View file @
9475cafa
...
...
@@ -118,8 +118,11 @@ yyerrorl(int line, char *fmt, ...)
hcrash
();
nerrors
++
;
if
(
nerrors
>=
10
&&
!
debug
[
'e'
])
fatal
(
"too many errors"
);
if
(
nerrors
>=
10
&&
!
debug
[
'e'
])
{
flusherrors
();
print
(
"%L: too many errors
\n
"
,
line
);
errorexit
();
}
}
extern
int
yystate
,
yychar
;
...
...
@@ -172,8 +175,11 @@ yyerror(char *fmt, ...)
hcrash
();
nerrors
++
;
if
(
nerrors
>=
10
&&
!
debug
[
'e'
])
fatal
(
"too many errors"
);
if
(
nerrors
>=
10
&&
!
debug
[
'e'
])
{
flusherrors
();
print
(
"%L: too many errors
\n
"
,
parserline
());
errorexit
();
}
}
void
...
...
@@ -195,12 +201,18 @@ fatal(char *fmt, ...)
flusherrors
();
print
(
"%L:
fatal
error: "
,
lineno
);
print
(
"%L:
internal compiler
error: "
,
lineno
);
va_start
(
arg
,
fmt
);
vfprint
(
1
,
fmt
,
arg
);
va_end
(
arg
);
print
(
"
\n
"
);
// If this is a released compiler version, ask for a bug report.
if
(
strncmp
(
getgoversion
(),
"release"
,
7
)
==
0
)
{
print
(
"
\n
"
);
print
(
"Please file a bug report including a short program that triggers the error.
\n
"
);
print
(
"http://code.google.com/p/go/issues/entry?template=compilerbug"
);
}
hcrash
();
errorexit
();
}
...
...
@@ -3549,8 +3561,10 @@ mkpkg(Strlit *path)
Pkg
*
p
;
int
h
;
if
(
strlen
(
path
->
s
)
!=
path
->
len
)
fatal
(
"import path contains NUL byte"
);
if
(
strlen
(
path
->
s
)
!=
path
->
len
)
{
yyerror
(
"import path contains NUL byte"
);
errorexit
();
}
h
=
stringhash
(
path
->
s
)
&
(
nelem
(
phash
)
-
1
);
for
(
p
=
phash
[
h
];
p
;
p
=
p
->
link
)
...
...
src/cmd/gc/typecheck.c
View file @
9475cafa
...
...
@@ -1709,7 +1709,7 @@ exportassignok(Type *t, char *desc)
prefix
=
" in "
;
else
desc
=
""
;
yyerror
(
"implicit assignment of
%T field '%s'%s%s"
,
t
,
s
->
name
,
prefix
,
desc
);
yyerror
(
"implicit assignment of
unexported field '%s' of %T%s%s"
,
s
->
name
,
t
,
prefix
,
desc
);
goto
no
;
}
if
(
!
exportassignok
(
f
->
type
,
desc
))
...
...
@@ -1935,7 +1935,7 @@ typecheckcomplit(Node **np)
}
s
=
f
->
sym
;
if
(
s
!=
nil
&&
!
exportname
(
s
->
name
)
&&
s
->
pkg
!=
localpkg
)
yyerror
(
"implicit assignment of
%T field '%s' in struct literal"
,
t
,
s
->
name
);
yyerror
(
"implicit assignment of
unexported field '%s' in %T literal"
,
s
->
name
,
t
);
ll
->
n
=
typecheckconv
(
nil
,
ll
->
n
,
f
->
type
,
0
,
"field value"
);
ll
->
n
=
nod
(
OKEY
,
newname
(
f
->
sym
),
ll
->
n
);
ll
->
n
->
left
->
typecheck
=
1
;
...
...
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