static int goto_passable(stmt *s) { struct label *lbl; int passable; if(s->expr){ /* could jump anywhere - assume it's not passable */ return 0; } lbl = s->bits.lbl.label; if(!lbl) return 1; /* safety */ if(!lbl->next_stmt) return 1; if(lbl->doing_passable_check){ /* infinite loop */ return 0; } /* this isn't perfect as it doesn't detect things like: * x: * printf("hi\n"); * goto x; * * but better to pessimise and warn/insert-main-return-0 * than to miss. */ lbl->doing_passable_check = 1; passable = fold_passable(lbl->next_stmt); lbl->doing_passable_check = 0; return passable; }
int label_passable(stmt *s) { return fold_passable(s->lhs); }
static int if_passable(stmt *s) { return fold_passable(s->lhs) || (s->rhs ? fold_passable(s->rhs) : 0); }
static int if_passable(stmt *s) { return (s->rhs ? fold_passable(s->rhs) : 1) || fold_passable(s->lhs); }