Skip to content

Commit 47259ee

Browse files
committed
Fix [-Wimplicit-fallthrough] warnings in Zend Engine
1 parent c99304e commit 47259ee

11 files changed

+31
-25
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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ static zend_never_inline ZEND_COLD zval *_get_zval_cv_lookup(zval *ptr, uint32_t
299299
break;
300300
case BP_VAR_RW:
301301
zval_undefined_cv(var EXECUTE_DATA_CC);
302-
/* break missing intentionally */
302+
fallthrough;
303303
case BP_VAR_W:
304304
ZVAL_NULL(ptr);
305305
break;
@@ -1351,6 +1351,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
13511351
}
13521352
case IS_UNDEF:
13531353
ZVAL_UNDEFINED_OP2();
1354+
fallthrough;
13541355
case IS_DOUBLE:
13551356
case IS_NULL:
13561357
case IS_FALSE:
@@ -2014,7 +2015,7 @@ static zend_never_inline zend_uchar slow_index_convert(HashTable *ht, const zval
20142015
if (EG(exception)) {
20152016
return IS_NULL;
20162017
}
2017-
/* break missing intentionally */
2018+
fallthrough;
20182019
}
20192020
case IS_NULL:
20202021
value->str = ZSTR_EMPTY_ALLOC();
@@ -2054,7 +2055,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20542055
switch (type) {
20552056
case BP_VAR_R:
20562057
zend_undefined_offset(hval);
2057-
/* break missing intentionally */
2058+
fallthrough;
20582059
case BP_VAR_UNSET:
20592060
case BP_VAR_IS:
20602061
retval = &EG(uninitialized_zval);
@@ -2063,7 +2064,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20632064
if (UNEXPECTED(zend_undefined_offset_write(ht, hval) == FAILURE)) {
20642065
return NULL;
20652066
}
2066-
/* break missing intentionally */
2067+
fallthrough;
20672068
case BP_VAR_W:
20682069
retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
20692070
break;
@@ -2085,7 +2086,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20852086
switch (type) {
20862087
case BP_VAR_R:
20872088
zend_undefined_index(offset_key);
2088-
/* break missing intentionally */
2089+
fallthrough;
20892090
case BP_VAR_UNSET:
20902091
case BP_VAR_IS:
20912092
retval = &EG(uninitialized_zval);
@@ -2094,7 +2095,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
20942095
if (UNEXPECTED(zend_undefined_index_write(ht, offset_key))) {
20952096
return NULL;
20962097
}
2097-
/* break missing intentionally */
2098+
fallthrough;
20982099
case BP_VAR_W:
20992100
ZVAL_NULL(retval);
21002101
break;
@@ -2105,7 +2106,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
21052106
switch (type) {
21062107
case BP_VAR_R:
21072108
zend_undefined_index(offset_key);
2108-
/* break missing intentionally */
2109+
fallthrough;
21092110
case BP_VAR_UNSET:
21102111
case BP_VAR_IS:
21112112
retval = &EG(uninitialized_zval);
@@ -2343,6 +2344,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
23432344
}
23442345
case IS_UNDEF:
23452346
ZVAL_UNDEFINED_OP2();
2347+
fallthrough;
23462348
case IS_DOUBLE:
23472349
case IS_NULL:
23482350
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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;

Zend/zend_language_scanner.l

Lines changed: 1 addition & 0 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;

Zend/zend_object_handlers.c

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

Zend/zend_opcode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static void emit_live_range(
704704
return;
705705
}
706706
}
707-
/* explicit fallthrough */
707+
fallthrough;
708708
default:
709709
start++;
710710
kind = ZEND_LIVE_TMPVAR;
@@ -994,14 +994,14 @@ ZEND_API void pass_two(zend_op_array *op_array)
994994
if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
995995
zend_check_finally_breakout(op_array, opline - op_array->opcodes, opline->op1.opline_num);
996996
}
997-
/* break omitted intentionally */
997+
fallthrough;
998998
case ZEND_JMP:
999999
ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
10001000
break;
10011001
case ZEND_JMPZNZ:
10021002
/* absolute index to relative offset */
10031003
opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
1004-
/* break omitted intentionally */
1004+
fallthrough;
10051005
case ZEND_JMPZ:
10061006
case ZEND_JMPNZ:
10071007
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;
@@ -2454,7 +2454,7 @@ ZEND_API zend_result ZEND_FASTCALL increment_function(zval *op1) /* {{{ */
24542454
return SUCCESS;
24552455
}
24562456
}
2457-
/* break missing intentionally */
2457+
fallthrough;
24582458
case IS_RESOURCE:
24592459
case IS_ARRAY:
24602460
zend_type_error("Cannot increment %s", zend_zval_type_name(op1));
@@ -2516,7 +2516,7 @@ ZEND_API zend_result ZEND_FASTCALL decrement_function(zval *op1) /* {{{ */
25162516
return SUCCESS;
25172517
}
25182518
}
2519-
/* break missing intentionally */
2519+
fallthrough;
25202520
case IS_RESOURCE:
25212521
case IS_ARRAY:
25222522
zend_type_error("Cannot decrement %s", zend_zval_type_name(op1));

Zend/zend_strtod.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ gethex( CONST char **sp, U *rvp, int rounding, int sign)
19111911
switch(*++s) {
19121912
case '-':
19131913
esign = 1;
1914-
/* no break */
1914+
fallthrough;
19151915
case '+':
19161916
s++;
19171917
}
@@ -2578,11 +2578,11 @@ zend_strtod
25782578
for(s = s00;;s++) switch(*s) {
25792579
case '-':
25802580
sign = 1;
2581-
/* no break */
2581+
fallthrough;
25822582
case '+':
25832583
if (*++s)
25842584
goto break2;
2585-
/* no break */
2585+
fallthrough;
25862586
case 0:
25872587
goto ret0;
25882588
case '\t':
@@ -2698,6 +2698,7 @@ zend_strtod
26982698
switch(c = *++s) {
26992699
case '-':
27002700
esign = 1;
2701+
fallthrough;
27012702
case '+':
27022703
c = *++s;
27032704
}
@@ -3952,15 +3953,15 @@ zend_dtoa
39523953
break;
39533954
case 2:
39543955
leftright = 0;
3955-
/* no break */
3956+
fallthrough;
39563957
case 4:
39573958
if (ndigits <= 0)
39583959
ndigits = 1;
39593960
ilim = ilim1 = i = ndigits;
39603961
break;
39613962
case 3:
39623963
leftright = 0;
3963-
/* no break */
3964+
fallthrough;
39643965
case 5:
39653966
i = ndigits + k + 1;
39663967
ilim = i;

0 commit comments

Comments
 (0)