Skip to content

Commit adf4c2b

Browse files
committed
Fix [-Wimplicit-fallthrough] warnings in Zend Engine
1 parent 437774f commit adf4c2b

13 files changed

+41
-34
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ static const char *zend_parse_arg_impl(zval *arg, va_list *va, const char **spec
884884
case 'Z': /* replace with 'z' */
885885
case 'L': /* replace with 'l' */
886886
ZEND_ASSERT(0 && "ZPP modifier no longer supported");
887+
fallthrough;
887888
default:
888889
return "unknown";
889890
}

Zend/zend_ast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio
20132013
break;
20142014
case ZEND_AST_PROP_ELEM:
20152015
smart_str_appendc(str, '$');
2016-
/* break missing intentionally */
2016+
fallthrough;
20172017
case ZEND_AST_CONST_ELEM:
20182018
zend_ast_export_name(str, ast->child[0], 0, indent);
20192019
APPEND_DEFAULT_VALUE(1);

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ ZEND_FUNCTION(define)
528528
val = &val_free;
529529
break;
530530
}
531-
/* no break */
531+
fallthrough;
532532
default:
533533
zval_ptr_dtor(&val_free);
534534
zend_argument_type_error(2, "cannot be an object, %s given", zend_zval_type_name(val));

Zend/zend_execute.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static zend_never_inline ZEND_COLD zval *_get_zval_cv_lookup(zval *ptr, uint32_t
298298
break;
299299
case BP_VAR_RW:
300300
zval_undefined_cv(var EXECUTE_DATA_CC);
301-
/* break missing intentionally */
301+
fallthrough;
302302
case BP_VAR_W:
303303
ZVAL_NULL(ptr);
304304
break;
@@ -1374,6 +1374,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
13741374
}
13751375
case IS_UNDEF:
13761376
ZVAL_UNDEFINED_OP2();
1377+
fallthrough;
13771378
case IS_DOUBLE:
13781379
case IS_NULL:
13791380
case IS_FALSE:
@@ -2037,7 +2038,7 @@ static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval
20372038
if (EG(exception)) {
20382039
return IS_NULL;
20392040
}
2040-
/* break missing intentionally */
2041+
fallthrough;
20412042
}
20422043
case IS_NULL:
20432044
value->str = ZSTR_EMPTY_ALLOC();
@@ -2077,7 +2078,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20772078
switch (type) {
20782079
case BP_VAR_R:
20792080
zend_undefined_offset(hval);
2080-
/* break missing intentionally */
2081+
fallthrough;
20812082
case BP_VAR_UNSET:
20822083
case BP_VAR_IS:
20832084
retval = &EG(uninitialized_zval);
@@ -2086,7 +2087,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20862087
if (UNEXPECTED(zend_undefined_offset_write(ht, hval) == FAILURE)) {
20872088
return NULL;
20882089
}
2089-
/* break missing intentionally */
2090+
fallthrough;
20902091
case BP_VAR_W:
20912092
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
20922093
break;
@@ -2104,7 +2105,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
21042105
switch (type) {
21052106
case BP_VAR_R:
21062107
zend_undefined_index(offset_key);
2107-
/* break missing intentionally */
2108+
fallthrough;
21082109
case BP_VAR_UNSET:
21092110
case BP_VAR_IS:
21102111
retval = &EG(uninitialized_zval);
@@ -2342,6 +2343,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
23422343
}
23432344
case IS_UNDEF:
23442345
ZVAL_UNDEFINED_OP2();
2346+
fallthrough;
23452347
case IS_DOUBLE:
23462348
case IS_NULL:
23472349
case IS_FALSE:

Zend/zend_highlight.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ ZEND_API void zend_strip(void)
184184
zend_write(" ", sizeof(" ") - 1);
185185
prev_space = 1;
186186
}
187-
/* lack of break; is intentional */
187+
fallthrough;
188188
case T_COMMENT:
189189
case T_DOC_COMMENT:
190190
ZVAL_UNDEF(&token);

Zend/zend_ini_scanner.l

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void zend_ini_copy_typed_value(zval *retval, const int type, const char *
187187
if (convert_to_number(retval, str, len) == SUCCESS) {
188188
break;
189189
}
190-
/* intentional fall-through */
190+
fallthrough;
191191
default:
192192
zend_ini_copy_value(retval, str, len);
193193
}
@@ -329,6 +329,7 @@ static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_ty
329329
*t++ = *s;
330330
break;
331331
}
332+
fallthrough;
332333
case '\\':
333334
case '$':
334335
*t++ = *s;
@@ -607,7 +608,7 @@ end_raw_value_chars:
607608
if (YYCURSOR < YYLIMIT && *YYCURSOR != '"') {
608609
YYCURSOR++;
609610
}
610-
/* fall through */
611+
fallthrough;
611612
default:
612613
continue;
613614
}

Zend/zend_language_scanner.l

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,7 @@ static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, c
998998
*t++ = *s;
999999
break;
10001000
}
1001+
fallthrough;
10011002
case '\\':
10021003
case '$':
10031004
*t++ = *s;
@@ -2372,7 +2373,7 @@ inline_char_handler:
23722373
YYCURSOR--;
23732374
break;
23742375
}
2375-
/* fall through */
2376+
fallthrough;
23762377
default:
23772378
continue;
23782379
}
@@ -2555,7 +2556,7 @@ skip_escape_conversion:
25552556
if (YYCURSOR < YYLIMIT) {
25562557
YYCURSOR++;
25572558
}
2558-
/* fall through */
2559+
fallthrough;
25592560
default:
25602561
continue;
25612562
}
@@ -2792,7 +2793,7 @@ skip_escape_conversion:
27922793
if (YYCURSOR < YYLIMIT) {
27932794
YYCURSOR++;
27942795
}
2795-
/* fall through */
2796+
fallthrough;
27962797
default:
27972798
continue;
27982799
}
@@ -2839,7 +2840,7 @@ double_quotes_scan_done:
28392840
if (YYCURSOR < YYLIMIT) {
28402841
YYCURSOR++;
28412842
}
2842-
/* fall through */
2843+
fallthrough;
28432844
default:
28442845
continue;
28452846
}
@@ -2875,7 +2876,7 @@ double_quotes_scan_done:
28752876
if (*YYCURSOR == '\n') {
28762877
YYCURSOR++;
28772878
}
2878-
/* fall through */
2879+
fallthrough;
28792880
case '\n':
28802881
indentation = spacing = 0;
28812882
@@ -2945,7 +2946,7 @@ double_quotes_scan_done:
29452946
if (YYCURSOR < YYLIMIT && *YYCURSOR != '\n' && *YYCURSOR != '\r') {
29462947
YYCURSOR++;
29472948
}
2948-
/* fall through */
2949+
fallthrough;
29492950
default:
29502951
continue;
29512952
}
@@ -2999,7 +3000,7 @@ heredoc_scan_done:
29993000
if (*YYCURSOR == '\n') {
30003001
YYCURSOR++;
30013002
}
3002-
/* fall through */
3003+
fallthrough;
30033004
case '\n':
30043005
indentation = spacing = 0;
30053006
@@ -3050,7 +3051,7 @@ heredoc_scan_done:
30503051
30513052
goto nowdoc_scan_done;
30523053
}
3053-
/* fall through */
3054+
fallthrough;
30543055
default:
30553056
continue;
30563057
}

Zend/zend_object_handlers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ ZEND_API HashTable *zend_std_get_properties_for(zend_object *obj, zend_prop_purp
17821782
}
17831783
return ht;
17841784
}
1785-
/* break missing intentionally */
1785+
fallthrough;
17861786
case ZEND_PROP_PURPOSE_ARRAY_CAST:
17871787
case ZEND_PROP_PURPOSE_SERIALIZE:
17881788
case ZEND_PROP_PURPOSE_VAR_EXPORT:

Zend/zend_opcode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ static void emit_live_range(
711711
return;
712712
}
713713
}
714-
/* explicit fallthrough */
714+
fallthrough;
715715
default:
716716
start++;
717717
kind = ZEND_LIVE_TMPVAR;
@@ -1001,14 +1001,14 @@ ZEND_API void pass_two(zend_op_array *op_array)
10011001
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
10021002
zend_check_finally_breakout(op_array, opline - op_array->opcodes, opline->op1.opline_num);
10031003
}
1004-
/* break omitted intentionally */
1004+
fallthrough;
10051005
case ZEND_JMP:
10061006
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
10071007
break;
10081008
case ZEND_JMPZNZ:
10091009
/* absolute index to relative offset */
10101010
opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
1011-
/* break omitted intentionally */
1011+
fallthrough;
10121012
case ZEND_JMPZ:
10131013
case ZEND_JMPNZ:
10141014
case ZEND_JMPZ_EX:

Zend/zend_operators.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ ZEND_API int ZEND_FASTCALL zend_atoi(const char *str, size_t str_len) /* {{{ */
9595
case 'g':
9696
case 'G':
9797
retval *= 1024;
98-
/* break intentionally missing */
98+
fallthrough;
9999
case 'm':
100100
case 'M':
101101
retval *= 1024;
102-
/* break intentionally missing */
102+
fallthrough;
103103
case 'k':
104104
case 'K':
105105
retval *= 1024;
@@ -123,11 +123,11 @@ ZEND_API zend_long ZEND_FASTCALL zend_atol(const char *str, size_t str_len) /* {
123123
case 'g':
124124
case 'G':
125125
retval *= 1024;
126-
/* break intentionally missing */
126+
fallthrough;
127127
case 'm':
128128
case 'M':
129129
retval *= 1024;
130-
/* break intentionally missing */
130+
fallthrough;
131131
case 'k':
132132
case 'K':
133133
retval *= 1024;
@@ -2443,7 +2443,7 @@ ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1) /* {{{ */
24432443
return SUCCESS;
24442444
}
24452445
}
2446-
/* break missing intentionally */
2446+
fallthrough;
24472447
case IS_RESOURCE:
24482448
case IS_ARRAY:
24492449
zend_type_error("Cannot increment %s", zend_zval_type_name(op1));
@@ -2505,7 +2505,7 @@ ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */
25052505
return SUCCESS;
25062506
}
25072507
}
2508-
/* break missing intentionally */
2508+
fallthrough;
25092509
case IS_RESOURCE:
25102510
case IS_ARRAY:
25112511
zend_type_error("Cannot decrement %s", zend_zval_type_name(op1));

0 commit comments

Comments
 (0)