Skip to content

Commit 35d8051

Browse files
committed
Drop -Wno-implicit-fallthrough compiler flag
And add it back to ext/date, ext/hash, and ext/opcache
1 parent 5be62fd commit 35d8051

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

UPGRADING.INTERNALS

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ PHP 8.1 INTERNALS UPGRADE NOTES
66
c. zend_get_opcode_id()
77

88
2. Build system changes
9+
a. New compiler flags
910

1011
3. Module changes
1112
a. ext/hash
@@ -39,7 +40,9 @@ PHP 8.1 INTERNALS UPGRADE NOTES
3940
========================
4041
2. Build system changes
4142
========================
42-
43+
a. New compiler flags
44+
- [-Wimplicit-fallthrough=1] is now enabled by default.
45+
It is possible to use the new ZEND_FALLTHROUGH macro keyword to suppress the warning.
4346
========================
4447
3. Module changes
4548
========================

Zend/Zend.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ else
206206
AC_DEFINE(ZEND_DEBUG,0,[ ])
207207
fi
208208
209-
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare $CFLAGS"
209+
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-unused-parameter -Wno-sign-compare $CFLAGS"
210210
dnl Check if compiler supports -Wno-clobbered (only GCC)
211211
AX_CHECK_COMPILE_FLAG([-Wno-clobbered], CFLAGS="-Wno-clobbered $CFLAGS", , [-Werror])
212+
dnl Check for support for implicit fallthrough level 1, also add after previous CFLAGS as level 3 is enabled in -Wextra
213+
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1], CFLAGS="$CFLAGS -Wimplicit-fallthrough=1", , [-Werror])
212214
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], CFLAGS="-Wduplicated-cond $CFLAGS", , [-Werror])
213215
AX_CHECK_COMPILE_FLAG([-Wlogical-op], CFLAGS="-Wlogical-op $CFLAGS", , [-Werror])
214216
AX_CHECK_COMPILE_FLAG([-Wformat-truncation], CFLAGS="-Wformat-truncation $CFLAGS", , [-Werror])

ext/date/config0.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AC_CHECK_HEADERS([io.h])
44
dnl Check for strtoll, atoll
55
AC_CHECK_FUNCS(strtoll atoll)
66

7-
PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
7+
PHP_DATE_CFLAGS="-Wno-implicit-fallthrough -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
88
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c
99
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
1010

ext/hash/config.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ else
2828
SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-opt64.c"
2929
])
3030
EXT_HASH_SHA3_SOURCES="$SHA3_OPT_SRC $SHA3_DIR/KeccakHash.c $SHA3_DIR/KeccakSponge.c hash_sha3.c"
31-
PHP_HASH_CFLAGS="-I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
31+
dnl Add -Wno-implicit-fallthrough flag as it happens on 32 bit builds
32+
PHP_HASH_CFLAGS="-Wno-implicit-fallthrough -I@ext_srcdir@/$SHA3_DIR -DKeccakP200_excluded -DKeccakP400_excluded -DKeccakP800_excluded -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
3233

3334
PHP_ADD_BUILD_DIR(ext/hash/$SHA3_DIR, 1)
3435
fi

ext/opcache/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ int main() {
326326
shared_alloc_mmap.c \
327327
shared_alloc_posix.c \
328328
$ZEND_JIT_SRC,
329-
shared,,-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1,,yes)
329+
shared,,"-Wno-implicit-fallthrough -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1",,yes)
330330

331331
PHP_ADD_EXTENSION_DEP(opcache, pcre)
332332

0 commit comments

Comments
 (0)