mirror of
https://github.com/php/php-src.git
synced 2024-11-26 19:33:55 +08:00
Merge branch 'PHP-8.3'
* PHP-8.3: Do not remove -O0 in the middle of a flag Fix removal of optimization cflags in debug builds (#9647)
This commit is contained in:
commit
c21899a9f0
12
build/php.m4
12
build/php.m4
@ -2533,3 +2533,15 @@ AS_VAR_IF([php_var], [yes],
|
||||
[Define to 1 if the compiler supports the '$1' variable attribute.])])
|
||||
AS_VAR_POPDEF([php_var])
|
||||
])
|
||||
|
||||
dnl
|
||||
dnl PHP_REMOVE_OPTIMIZATION_FLAGS
|
||||
dnl
|
||||
dnl Removes known compiler optimization flags like -O, -O0, -O1, ..., -Ofast
|
||||
dnl from CFLAGS and CXXFLAGS.
|
||||
dnl
|
||||
AC_DEFUN([PHP_REMOVE_OPTIMIZATION_FLAGS], [
|
||||
sed_script='s/\([[\t ]]\|^\)-O\([[0-9gsz]]\|fast\|\)\([[\t ]]\|$\)/\1/g'
|
||||
CFLAGS=$(echo "$CFLAGS" | $SED -e "$sed_script")
|
||||
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e "$sed_script")
|
||||
])
|
||||
|
12
configure.ac
12
configure.ac
@ -785,11 +785,7 @@ AS_VAR_IF([PHP_GCOV], [yes], [
|
||||
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/build/Makefile.gcov], [$abs_srcdir])
|
||||
|
||||
dnl Remove all optimization flags from CFLAGS.
|
||||
changequote({,})
|
||||
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
|
||||
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
changequote([,])
|
||||
PHP_REMOVE_OPTIMIZATION_FLAGS
|
||||
|
||||
dnl Add the special gcc flags.
|
||||
CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
|
||||
@ -806,11 +802,7 @@ PHP_ARG_ENABLE([debug],
|
||||
AS_VAR_IF([PHP_DEBUG], [yes], [
|
||||
PHP_DEBUG=1
|
||||
ZEND_DEBUG=yes
|
||||
changequote({,})
|
||||
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
|
||||
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
changequote([,])
|
||||
PHP_REMOVE_OPTIMIZATION_FLAGS
|
||||
dnl Add -O0 only if GCC or ICC is used.
|
||||
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
|
||||
CFLAGS="$CFLAGS -O0"
|
||||
|
@ -104,11 +104,7 @@ dnl Discard optimization flags when debugging is enabled.
|
||||
AS_VAR_IF([PHP_DEBUG], [yes], [
|
||||
PHP_DEBUG=1
|
||||
ZEND_DEBUG=yes
|
||||
changequote({,})
|
||||
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
|
||||
CFLAGS=$(echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
CXXFLAGS=$(echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g')
|
||||
changequote([,])
|
||||
PHP_REMOVE_OPTIMIZATION_FLAGS
|
||||
dnl Add -O0 only if GCC or ICC is used.
|
||||
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
|
||||
CFLAGS="$CFLAGS -O0"
|
||||
|
Loading…
Reference in New Issue
Block a user