On 11/25/2017 04:01 AM, Jakub Jelinek wrote:
/* Set if the body of a switch stmt contains a default: case label
and does not contain any break; stmts, thus if SWITCH_STMT_BODY
is not empty and doesn't fallthru, then the whole switch stmt
can't. */
#define SWITCH_STMT_CANT_FALLTHRU_P(NODE) \
TREE_LANG_FLAG_0 (SWITCH_STMT_CHECK (NODE))
Seems the C++ FE already has switch_stack, so we could just add there
a has_default_p, has_break_stmt_p and inside_loop_p flags and both
inside of templates and outside in finish_case_label, in
finish_break_stmt if actually adding BREAK_STMT and when entering
a body of a FOR/DO/WHILE loop tweak those flags. Seems switch_stack
is also maintained during pt.c, but we should compute it both during
parsing and during pt.c (start with the bit clear on a new SWITCH_STMT).
Thoughts on this?
Sigh, should have read further. Yes, I'm all for setting such a flag
during construction. (I presume doing so is essentially free)
nathan
--
Nathan Sidwell