1
0
mirror of https://github.com/golang/go synced 2024-11-25 01:57:56 -07:00

warn -> yyerror in mparith.

close two more bugs.

R=ken
OCL=26226
CL=26226
This commit is contained in:
Russ Cox 2009-03-12 19:57:30 -07:00
parent f8ba0f4511
commit 5fbadf0bc3
7 changed files with 25 additions and 38 deletions

View File

@ -215,12 +215,6 @@ xdcl:
autoexport($1->nname->sym); autoexport($1->nname->sym);
$$ = N; $$ = N;
} }
| LPACKAGE { warn("package is gone"); } xfndcl
{
if($3 != N && $3->nname != N)
packagesym($3->nname->sym);
$$ = N;
}
| ';' | ';'
{ {
$$ = N; $$ = N;
@ -1660,7 +1654,7 @@ exprsym3_list_r:
import_stmt_list_r: import_stmt_list_r:
import_stmt import_stmt
| import_stmt_list_r osemi import_stmt | import_stmt_list_r ';' import_stmt
hidden_import_list_r: hidden_import_list_r:
| hidden_import_list_r hidden_import | hidden_import_list_r hidden_import

View File

@ -308,7 +308,7 @@ out:
return; return;
bad: bad:
warn("set ovf in mpatof"); yyerror("set ovf in mpatof");
mpmovecflt(a, 0.0); mpmovecflt(a, 0.0);
} }
@ -396,7 +396,7 @@ out:
return; return;
bad: bad:
warn("set ovf in mpatov: %s", as); yyerror("set ovf in mpatov: %s", as);
mpmovecfix(a, 0); mpmovecfix(a, 0);
} }

View File

@ -119,7 +119,7 @@ mpcmp(Mpint *a, Mpint *b)
int i; int i;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in cmp"); yyerror("ovf in cmp");
return 0; return 0;
} }
@ -194,7 +194,7 @@ mpaddfixfix(Mpint *a, Mpint *b)
long x, *a1, *b1; long x, *a1, *b1;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mpaddxx"); yyerror("ovf in mpaddxx");
a->ovf = 1; a->ovf = 1;
return; return;
} }
@ -217,7 +217,7 @@ mpaddfixfix(Mpint *a, Mpint *b)
} }
a->ovf = c; a->ovf = c;
if(a->ovf) if(a->ovf)
warn("set ovf in mpaddxx"); yyerror("set ovf in mpaddxx");
return; return;
@ -264,7 +264,7 @@ mpmulfixfix(Mpint *a, Mpint *b)
Mpint s, q; Mpint s, q;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mpmulfixfix"); yyerror("ovf in mpmulfixfix");
a->ovf = 1; a->ovf = 1;
return; return;
} }
@ -297,7 +297,7 @@ mpmulfixfix(Mpint *a, Mpint *b)
q.neg = a->neg ^ b->neg; q.neg = a->neg ^ b->neg;
mpmovefixfix(a, &q); mpmovefixfix(a, &q);
if(a->ovf) if(a->ovf)
warn("set ovf in mpmulfixfix"); yyerror("set ovf in mpmulfixfix");
} }
void void
@ -309,7 +309,7 @@ mpmulfract(Mpint *a, Mpint *b)
Mpint s, q; Mpint s, q;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mpmulflt"); yyerror("ovf in mpmulflt");
a->ovf = 1; a->ovf = 1;
return; return;
} }
@ -336,7 +336,7 @@ mpmulfract(Mpint *a, Mpint *b)
q.neg = a->neg ^ b->neg; q.neg = a->neg ^ b->neg;
mpmovefixfix(a, &q); mpmovefixfix(a, &q);
if(a->ovf) if(a->ovf)
warn("set ovf in mpmulflt"); yyerror("set ovf in mpmulflt");
} }
void void
@ -346,7 +346,7 @@ mporfixfix(Mpint *a, Mpint *b)
long x, *a1, *b1; long x, *a1, *b1;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mporfixfix"); yyerror("ovf in mporfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
@ -380,7 +380,7 @@ mpandfixfix(Mpint *a, Mpint *b)
long x, *a1, *b1; long x, *a1, *b1;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mpandfixfix"); yyerror("ovf in mpandfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
@ -414,7 +414,7 @@ mpandnotfixfix(Mpint *a, Mpint *b)
long x, *a1, *b1; long x, *a1, *b1;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mpandnotfixfix"); yyerror("ovf in mpandnotfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
@ -448,7 +448,7 @@ mpxorfixfix(Mpint *a, Mpint *b)
long x, *a1, *b1; long x, *a1, *b1;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mporfixfix"); yyerror("ovf in mporfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
@ -481,14 +481,14 @@ mplshfixfix(Mpint *a, Mpint *b)
vlong s; vlong s;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mporfixfix"); yyerror("ovf in mporfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
} }
s = mpgetfix(b); s = mpgetfix(b);
if(s < 0 || s >= Mpprec*Mpscale) { if(s < 0 || s >= Mpprec*Mpscale) {
warn("stupid shift: %lld", s); yyerror("stupid shift: %lld", s);
mpmovecfix(a, 0); mpmovecfix(a, 0);
return; return;
} }
@ -502,14 +502,14 @@ mprshfixfix(Mpint *a, Mpint *b)
vlong s; vlong s;
if(a->ovf || b->ovf) { if(a->ovf || b->ovf) {
warn("ovf in mprshfixfix"); yyerror("ovf in mprshfixfix");
mpmovecfix(a, 0); mpmovecfix(a, 0);
a->ovf = 1; a->ovf = 1;
return; return;
} }
s = mpgetfix(b); s = mpgetfix(b);
if(s < 0 || s >= Mpprec*Mpscale) { if(s < 0 || s >= Mpprec*Mpscale) {
warn("stupid shift: %lld", s); yyerror("stupid shift: %lld", s);
if(a->neg) if(a->neg)
mpmovecfix(a, -1); mpmovecfix(a, -1);
else else
@ -532,7 +532,7 @@ mpgetfix(Mpint *a)
vlong v; vlong v;
if(a->ovf) { if(a->ovf) {
warn("ovf in mpgetfix"); yyerror("ovf in mpgetfix");
return 0; return 0;
} }
@ -588,7 +588,7 @@ mpdivmodfixfix(Mpint *q, Mpint *r, Mpint *n, Mpint *d)
if(i >= Mpprec*Mpscale) { if(i >= Mpprec*Mpscale) {
q->ovf = 1; q->ovf = 1;
r->ovf = 1; r->ovf = 1;
warn("set ovf in mpdivmodfixfix"); yyerror("set ovf in mpdivmodfixfix");
return; return;
} }

View File

@ -134,7 +134,7 @@ mpdivfltflt(Mpflt *a, Mpflt *b)
a->exp = 0; a->exp = 0;
a->val.neg = 0; a->val.neg = 0;
a->val.ovf = 1; a->val.ovf = 1;
warn("mpdivfltflt divide by zero"); yyerror("mpdivfltflt divide by zero");
return; return;
} }
if(sa == 0) { if(sa == 0) {
@ -165,14 +165,14 @@ mpgetflt(Mpflt *a)
double f; double f;
if(a->val.ovf) if(a->val.ovf)
warn("mpgetflt ovf"); yyerror("mpgetflt ovf");
s = sigfig(a); s = sigfig(a);
if(s == 0) if(s == 0)
return 0; return 0;
if(s != Mpnorm) { if(s != Mpnorm) {
warn("mpgetflt norm"); yyerror("mpgetflt norm");
mpnorm(a); mpnorm(a);
} }

View File

@ -6,5 +6,5 @@
package main package main
func f() { func f() {
v := 1 << 1025; // ERROR "overflow" v := 1 << 1025; // ERROR "overflow|stupid shift"
} }

View File

@ -8,7 +8,7 @@ package main
import ( import (
OS "os" // should require semicolon here; this is no different from other decls OS "os" // should require semicolon here; this is no different from other decls
IO "io" // ERROR "missing" IO "io" // ERROR "missing|syntax"
) )
func main() { func main() {

View File

@ -106,10 +106,6 @@ abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz-abcxyz
=========== chan/nonblock.go =========== chan/nonblock.go
PASS PASS
=========== bugs/bug108.go
bugs/bug108.go:4: stupid shift: 1025
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug108.go
=========== bugs/bug115.go =========== bugs/bug115.go
bugs/bug115.go:8: constant -1 overflows uint bugs/bug115.go:8: constant -1 overflows uint
BUG: bug115 should compile BUG: bug115 should compile
@ -120,9 +116,6 @@ bugs/bug117.go:9: illegal types for operand: RETURN
int int
BUG: should compile BUG: should compile
=========== bugs/bug125.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go
=========== bugs/bug131.go =========== bugs/bug131.go
bugs/bug131.go:7: cannot convert uint64 constant to int64 bugs/bug131.go:7: cannot convert uint64 constant to int64
bugs/bug131.go:7: illegal types for operand: AS bugs/bug131.go:7: illegal types for operand: AS