Skip to content

Commit 5c87075

Browse files
authored
Autotools: Sync CS in Zend.m4 (#15304)
- Autoconf sets the GCC variable to either "yes" if GNU C compatible compiler is detected (like gcc or clang) or to an empty value otherwise. - AX_CHECK_COMPILE_FLAG arguments quoted and empty arguments trimmed
1 parent 02e22a5 commit 5c87075

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

Zend/Zend.m4

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,33 @@ AS_VAR_IF([ZEND_DEBUG], [yes], [
182182
fi
183183
], [AC_DEFINE([ZEND_DEBUG], [0])])
184184
185-
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $CFLAGS"
186-
dnl Check if compiler supports -Wno-clobbered (only GCC)
187-
AX_CHECK_COMPILE_FLAG([-Wno-clobbered], CFLAGS="-Wno-clobbered $CFLAGS", , [-Werror])
188-
dnl Check for support for implicit fallthrough level 1, also add after previous CFLAGS as level 3 is enabled in -Wextra
189-
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1], CFLAGS="$CFLAGS -Wimplicit-fallthrough=1", , [-Werror])
190-
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], CFLAGS="-Wduplicated-cond $CFLAGS", , [-Werror])
191-
AX_CHECK_COMPILE_FLAG([-Wlogical-op], CFLAGS="-Wlogical-op $CFLAGS", , [-Werror])
192-
AX_CHECK_COMPILE_FLAG([-Wformat-truncation], CFLAGS="-Wformat-truncation $CFLAGS", , [-Werror])
193-
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes], CFLAGS="-Wstrict-prototypes $CFLAGS", , [-Werror])
194-
AX_CHECK_COMPILE_FLAG([-fno-common], CFLAGS="-fno-common $CFLAGS", , [-Werror])
185+
AS_VAR_IF([GCC], [yes],
186+
[CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $CFLAGS"])
187+
188+
dnl Check if compiler supports -Wno-clobbered (only GCC).
189+
AX_CHECK_COMPILE_FLAG([-Wno-clobbered],
190+
[CFLAGS="-Wno-clobbered $CFLAGS"],,
191+
[-Werror])
192+
dnl Check for support for implicit fallthrough level 1, also add after previous
193+
dnl CFLAGS as level 3 is enabled in -Wextra.
194+
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1],
195+
[CFLAGS="$CFLAGS -Wimplicit-fallthrough=1"],,
196+
[-Werror])
197+
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond],
198+
[CFLAGS="-Wduplicated-cond $CFLAGS"],,
199+
[-Werror])
200+
AX_CHECK_COMPILE_FLAG([-Wlogical-op],
201+
[CFLAGS="-Wlogical-op $CFLAGS"],,
202+
[-Werror])
203+
AX_CHECK_COMPILE_FLAG([-Wformat-truncation],
204+
[CFLAGS="-Wformat-truncation $CFLAGS"],,
205+
[-Werror])
206+
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],
207+
[CFLAGS="-Wstrict-prototypes $CFLAGS"],,
208+
[-Werror])
209+
AX_CHECK_COMPILE_FLAG([-fno-common],
210+
[CFLAGS="-fno-common $CFLAGS"],,
211+
[-Werror])
195212
196213
ZEND_CHECK_ALIGNMENT
197214
ZEND_CHECK_SIGNALS
@@ -300,7 +317,8 @@ int emu(const opcode_handler_t *ip, void *fp) {
300317
])
301318
AS_VAR_IF([php_cv_have_global_register_vars], [yes],
302319
[AC_DEFINE([HAVE_GCC_GLOBAL_REGS], [1],
303-
[Define to 1 if the target system has support for global register variables.])],
320+
[Define to 1 if the target system has support for global register
321+
variables.])],
304322
[ZEND_GCC_GLOBAL_REGS=no])
305323
])
306324
AC_MSG_CHECKING([whether to enable global register variables support])

0 commit comments

Comments
 (0)