@@ -797,6 +797,7 @@ static cb_tree
797
797
cb_check_needs_break (cb_tree stmt )
798
798
{
799
799
cb_tree l ;
800
+ int needs_a_break = 1 ;
800
801
801
802
/* Check if last statement is GO TO */
802
803
for (l = stmt ; l ; l = CB_CHAIN (l )) {
@@ -806,12 +807,15 @@ cb_check_needs_break (cb_tree stmt)
806
807
}
807
808
if (l && CB_VALUE (l ) && CB_STATEMENT_P (CB_VALUE (l ))) {
808
809
l = CB_STATEMENT (CB_VALUE (l ))-> body ;
809
- if (l && CB_VALUE (l ) && !CB_GOTO_P (CB_VALUE (l ))) {
810
- /* Append a break */
811
- l = cb_build_direct ("break;" , 0 );
812
- return cb_list_add (stmt , l );
810
+ if (l && CB_VALUE (l ) && CB_GOTO_P (CB_VALUE (l ))) {
811
+ needs_a_break = 0 ;
813
812
}
814
813
}
814
+
815
+ if (needs_a_break ){
816
+ l = cb_build_direct ("break;" , 0 );
817
+ return cb_list_add (stmt , l );
818
+ }
815
819
return stmt ;
816
820
}
817
821
@@ -10019,6 +10023,7 @@ build_evaluate (cb_tree subject_list, cb_tree case_list, cb_tree goto_end_label)
10019
10023
cb_source_line = old_line ;
10020
10024
10021
10025
} else {
10026
+ int need_end_goto = 1 ;
10022
10027
c2 = stmt ;
10023
10028
/* Check if last statement is GO TO */
10024
10029
for (c3 = stmt ; c3 ; c3 = CB_CHAIN (c3 )) {
@@ -10028,11 +10033,14 @@ build_evaluate (cb_tree subject_list, cb_tree case_list, cb_tree goto_end_label)
10028
10033
}
10029
10034
if (c3 && CB_VALUE (c3 ) && CB_STATEMENT_P (CB_VALUE (c3 ))) {
10030
10035
c3 = CB_STATEMENT (CB_VALUE (c3 ))-> body ;
10031
- if (c3 && CB_VALUE (c3 ) && !CB_GOTO_P (CB_VALUE (c3 ))) {
10032
- /* Append the jump */
10033
- c2 = cb_list_add (stmt , goto_end_label );
10036
+ if (c3 && CB_VALUE (c3 ) && CB_GOTO_P (CB_VALUE (c3 ))) {
10037
+ need_end_goto = 0 ;
10034
10038
}
10035
10039
}
10040
+ if (need_end_goto ){
10041
+ /* Append the jump */
10042
+ c2 = cb_list_add (stmt , goto_end_label );
10043
+ }
10036
10044
cb_emit (cb_build_if (cb_build_cond (c1 ), c2 , NULL , STMT_WHEN ));
10037
10045
build_evaluate (subject_list , CB_CHAIN (case_list ), goto_end_label );
10038
10046
}
0 commit comments