@@ -1097,12 +1097,6 @@ static void defer_add(Token *defer_keyword, Token *start, Token *end) {
10971097 defer_stack [defer_count ++ ] = (DeferEntry ){start , end , defer_keyword };
10981098}
10991099
1100- static int find_switch_scope (void ) {
1101- for (int d = ctx -> scope_depth - 1 ; d >= 0 ; d -- )
1102- if (scope_stack [d ].kind == SCOPE_BLOCK && scope_stack [d ].is_switch ) return d ;
1103- return -1 ;
1104- }
1105-
11061100
11071101static bool needs_space (Token * prev , Token * tok ) {
11081102 if (!prev || tok_at_bol (tok )) return false;
@@ -3549,10 +3543,8 @@ static Token *handle_const_orelse_fallback(Token *tok,
35493543 // The old &*(T)0 trick dereferences void* which is a constraint violation
35503544 // under C99 §6.5.3.2p2 (GCC/Clang tolerate it, but it's non-conforming).
35513545 bool const_td_is_ptr = false;
3552- bool const_td_is_array = false;
35533546 for (Token * t = type_start ; t != type -> end ; t = tok_next (t )) {
35543547 if (is_ptr_typedef (t )) { const_td_is_ptr = true; break ; }
3555- if (is_array_typedef (t )) { const_td_is_array = true; break ; }
35563548 }
35573549
35583550 if (pragma_start != type_start )
@@ -3563,12 +3555,6 @@ static Token *handle_const_orelse_fallback(Token *tok,
35633555 out_char (' ' ); emit_typeof_keyword (); OUT_LIT ("((" );
35643556 emit_type_range (type_start , type -> end , strip_type_const , true);
35653557 OUT_LIT (")0)" );
3566- } else if (const_td_is_array ) {
3567- out_char (' ' ); emit_typeof_keyword (); OUT_LIT ("(*(0 ? (" );
3568- emit_type_range (type_start , type -> end , strip_type_const , true);
3569- OUT_LIT ("*)0 : (" );
3570- emit_type_range (type_start , type -> end , strip_type_const , true);
3571- OUT_LIT ("*)0))" );
35723558 } else {
35733559 out_char (' ' ); emit_typeof_keyword (); OUT_LIT ("((" );
35743560 emit_type_range (type_start , type -> end , strip_type_const , true);
@@ -5090,30 +5076,7 @@ static Token *handle_goto_keyword(Token *tok) {
50905076}
50915077
50925078static void handle_case_default (Token * tok ) {
5093- if (!FEAT (F_DEFER )) return ;
5094- // Braceless switch: ctrl_state.pending is still active, meaning no
5095- // SCOPE_BLOCK was pushed for this switch. find_switch_scope() would
5096- // leak through to an enclosing braced switch and corrupt its defer
5097- // stack. Braceless bodies can't contain defers, so just bail out.
5098- if (ctrl_state .pending && ctrl_state .parens_just_closed ) return ;
5099- int sd = find_switch_scope ();
5100- if (sd < 0 ) return ;
5101- bool is_case = tok -> tag & TT_CASE ;
5102- bool is_default = (tok -> tag & TT_DEFAULT ) && !in_generic ();
5103- if (is_default ) {
5104- Token * t = skip_noise (tok_next (tok ));
5105- if (!t || !match_ch (t , ':' )) return ;
5106- }
5107- if (!is_case && !is_default ) return ;
5108-
5109- // Defer-fallthrough and zero-init-bypass errors are now caught by
5110- // p1_verify_cfg (Phase 2A) before any code is emitted. Pass 2 only
5111- // needs to reset the defer stack to the switch scope level so that
5112- // defers emitted in previous case arms don't bleed into the next one.
5113- for (int d = ctx -> scope_depth - 1 ; d >= sd ; d -- ) {
5114- if (scope_stack [d ].kind != SCOPE_BLOCK ) continue ;
5115- defer_count = scope_stack [d ].defer_start_idx ;
5116- }
5079+ (void )tok ; // defer-fallthrough is caught by p1_verify_cfg (Phase 2A)
51175080}
51185081
51195082static Token * handle_sue_body (Token * tok ) {
@@ -6911,6 +6874,14 @@ static Token *skip_one_stmt_impl(Token *tok, uint32_t *cache) {
69116874 goto unwind_if ;
69126875 }
69136876
6877+ // User-defined label: ident ':' (not '::')
6878+ if (is_identifier_like (tok ) && !(tok -> tag & (TT_CASE | TT_DEFAULT | TT_TYPE | TT_QUALIFIER | TT_STORAGE ))) {
6879+ Token * colon = skip_noise (tok_next (tok ));
6880+ if (colon && match_ch (colon , ':' ) && !(tok_next (colon ) && match_ch (tok_next (colon ), ':' ))) {
6881+ tok = tok_next (colon ); goto restart ;
6882+ }
6883+ }
6884+
69146885 // 'case' / 'default' label: skip expr + ':', tail-call on body
69156886 if ((tok -> tag & (TT_CASE | TT_DEFAULT )) && !is_known_typedef (tok )) {
69166887 int td = 0 ;
0 commit comments