Closed Bug 550909 Opened 10 years ago Closed 3 years ago

unreachable code in ComprehensionTail

Categories

(Core :: JavaScript Engine, defect, trivial)

x86
Linux
defect
Not set
trivial

Tracking

()

RESOLVED INVALID

People

(Reporter: timeless, Unassigned)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity)

I understand this is defensive programming, but i wonder if a comment for the parallel switches might be better (it's also possible to tell coverity to shut up, I just don't have handy access to the documentation, so, i'd have to find someone to look it up)

6731 ComprehensionTail(JSParseNode *kid, uintN blockid, JSTreeContext *tc,

6816         switch (tt) {
6818           case TOK_LB:
6819           case TOK_LC:
6825             break;
6828           case TOK_NAME:
6841             break;

6843           default:
6847           case TOK_ERROR:
6848             return NULL;
6849         }

after this switch, tt must be TOK_LB, TOK_LC, or TOK_NAME

6857         switch (tt) {
6859           case TOK_LB:
6860           case TOK_LC:
6877             break;
6880           case TOK_NAME:
6884             break;

so this isn't reachable:
6886           default:;
6887         }
We do this to avoid GCC warnings. Will GCC versions (all supported) track the data and control flow and avoid warning that the second switch is not exhaustive?

/be
Assignee: general → nobody
No longer valid, legacy comprehensions were removed.
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.