diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-04 11:06:32 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-03-04 11:06:32 +0000 |
commit | 736393e5aea7a1bbe7b0af2f28fc23eb29a9fde2 (patch) | |
tree | 92460f53d9e91b8dcf0b9b59cd6749d9166388c1 /gcc/c-typeck.c | |
parent | a172c36d9f8845bb8211937afc3e57a01edeaaf3 (diff) | |
download | ppe42-gcc-736393e5aea7a1bbe7b0af2f28fc23eb29a9fde2.tar.gz ppe42-gcc-736393e5aea7a1bbe7b0af2f28fc23eb29a9fde2.zip |
PR c/9262
* c-typeck.c (do_case): Attach the first case label to the SWITCH_BODY.
(c_finish_case): Rechain the next statements to the SWITCH_STMT.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63783 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r-- | gcc/c-typeck.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 01a7c92a665..8302a9678f0 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -7184,11 +7184,19 @@ do_case (low_value, high_value) if (switch_stack) { + bool switch_was_empty_p = (SWITCH_BODY (switch_stack->switch_stmt) == NULL_TREE); + label = c_add_case_label (switch_stack->cases, SWITCH_COND (switch_stack->switch_stmt), low_value, high_value); if (label == error_mark_node) label = NULL_TREE; + else if (switch_was_empty_p) + { + /* Attach the first case label to the SWITCH_BODY. */ + SWITCH_BODY (switch_stack->switch_stmt) = TREE_CHAIN (switch_stack->switch_stmt); + TREE_CHAIN (switch_stack->switch_stmt) = NULL_TREE; + } } else if (low_value) error ("case label not within a switch statement"); @@ -7205,7 +7213,8 @@ c_finish_case () { struct c_switch *cs = switch_stack; - RECHAIN_STMTS (cs->switch_stmt, SWITCH_BODY (cs->switch_stmt)); + /* Rechain the next statements to the SWITCH_STMT. */ + last_tree = cs->switch_stmt; /* Pop the stack. */ switch_stack = switch_stack->next; |