diff --git a/compiler/generator.c b/compiler/generator.c index 0306873c..ac96ab8b 100644 --- a/compiler/generator.c +++ b/compiler/generator.c @@ -447,8 +447,10 @@ static int check_possible_signals(struct generator * g, if (res >= 0) res = !res; if (res == 0 && p->right) { - fprintf(stderr, "%s:%d: warning: 'not' always signals f so following commands are unreachable\n", - g->analyser->tokeniser->file, p->line_number); + if (p->right->type != c_functionend) { + fprintf(stderr, "%s:%d: warning: 'not' always signals f so following commands are unreachable\n", + g->analyser->tokeniser->file, p->line_number); + } p->right = NULL; } return res; @@ -567,8 +569,11 @@ static int check_possible_signals(struct generator * g, // If any clause of the OR always signals t, then the OR // always signals t. if (q->right) { - fprintf(stderr, "%s:%d: warning: command always signals t here so rest of 'or' is unreachable\n", - g->analyser->tokeniser->file, q->line_number); + if (q->right->type != c_functionend) { + fprintf(stderr, "%s:%d: warning: command always signals t here so rest of 'or' is unreachable\n", + g->analyser->tokeniser->file, + q->line_number); + } q->right = NULL; } return 1; @@ -595,9 +600,11 @@ int check_possible_signals_list(struct generator * g, struct node * p, if (res == 0) { // If any command always signals f, then the list always signals f. if (p->right) { - fprintf(stderr, "%s:%d: warning: command always signals f here so rest of %s is unreachable\n", - g->analyser->tokeniser->file, p->line_number, - (type == c_and ? "'and'" : "command list")); + if (p->right->type != c_functionend) { + fprintf(stderr, "%s:%d: warning: command always signals f here so rest of %s is unreachable\n", + g->analyser->tokeniser->file, p->line_number, + (type == c_and ? "'and'" : "command list")); + } p->right = NULL; } return res;