mirror of
https://github.com/golang/go
synced 2024-11-25 08:17:58 -07:00
bogus diagnostic with
default as first case in a switch SVN=123398
This commit is contained in:
parent
c242b53d22
commit
1926fef175
@ -440,7 +440,7 @@ swgen(Node *n)
|
|||||||
while(c1 != N) {
|
while(c1 != N) {
|
||||||
dynlineno = c1->lineno; // for diagnostics
|
dynlineno = c1->lineno; // for diagnostics
|
||||||
if(c1->op != OCASE) {
|
if(c1->op != OCASE) {
|
||||||
if(s0 == C)
|
if(s0 == C && dflt == P)
|
||||||
yyerror("unreachable statements in a switch");
|
yyerror("unreachable statements in a switch");
|
||||||
gen(c1);
|
gen(c1);
|
||||||
|
|
||||||
@ -463,7 +463,6 @@ swgen(Node *n)
|
|||||||
dflt = pc;
|
dflt = pc;
|
||||||
|
|
||||||
while(c2 != N) {
|
while(c2 != N) {
|
||||||
|
|
||||||
s = mal(sizeof(*s));
|
s = mal(sizeof(*s));
|
||||||
if(s0 == C)
|
if(s0 == C)
|
||||||
s0 = s;
|
s0 = s;
|
||||||
|
@ -116,6 +116,7 @@ loop:
|
|||||||
walktype(n->ninit, Etop);
|
walktype(n->ninit, Etop);
|
||||||
walktype(n->ntest, Erv);
|
walktype(n->ntest, Erv);
|
||||||
walktype(n->nbody, Etop);
|
walktype(n->nbody, Etop);
|
||||||
|
|
||||||
// find common type
|
// find common type
|
||||||
if(n->ntest->type == T)
|
if(n->ntest->type == T)
|
||||||
n->ntest->type = walkswitch(n, sw1);
|
n->ntest->type = walkswitch(n, sw1);
|
||||||
@ -127,11 +128,9 @@ loop:
|
|||||||
// set the type on all literals
|
// set the type on all literals
|
||||||
if(n->ntest->type != T)
|
if(n->ntest->type != T)
|
||||||
walkswitch(n, sw3);
|
walkswitch(n, sw3);
|
||||||
|
walktype(n->ntest, Erv); // BOTCH is this right
|
||||||
walktype(n->ntest, Erv);
|
walktype(n->nincr, Erv);
|
||||||
|
goto ret;
|
||||||
n = n->nincr;
|
|
||||||
goto loop;
|
|
||||||
|
|
||||||
case OEMPTY:
|
case OEMPTY:
|
||||||
if(top != Etop)
|
if(top != Etop)
|
||||||
|
Loading…
Reference in New Issue
Block a user