Skip to content

Commit dbd04b0

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 52e0d79 + 4fe71b6 commit dbd04b0

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

cmake/Zend/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ if(BISON_FOUND)
486486
zend_ini_parser
487487
zend_ini_parser.y
488488
${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.c
489-
COMPILE_FLAGS "-Wall -d"
490-
VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/zend_ini_parser.output
489+
COMPILE_FLAGS "${PHP_DEFAULT_BISON_FLAGS}"
490+
VERBOSE REPORT_FILE zend_ini_parser.output
491491
DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.h
492492
)
493493

@@ -498,8 +498,8 @@ if(BISON_FOUND)
498498
zend_language_parser
499499
zend_language_parser.y
500500
${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.c
501-
COMPILE_FLAGS "-Wall -d"
502-
VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/zend_language_parser.output
501+
COMPILE_FLAGS "${PHP_DEFAULT_BISON_FLAGS}"
502+
VERBOSE REPORT_FILE zend_language_parser.output
503503
DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.h
504504
)
505505

cmake/cmake/BuildTypes.cmake

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ block()
2222
allowedBuildTypes
2323
Debug # Debug info, assertions, not optimized.
2424
DebugAssertions # Custom PHP debug build type with assertions enabled
25-
# in the release mode. TODO: Adjust the flags.
26-
MinSizeRel # Optimized for size rather than speed.
25+
# in the RelWithDebInfo mode: optimized, debug info,
26+
# assertions.
27+
MinSizeRel # Same as Release but optimized for size rather than
28+
# speed.
2729
Release # No debug info, no assertions, optimized.
2830
RelWithDebInfo # Debug info, optimized, no assertions.
2931
)
@@ -51,3 +53,14 @@ target_compile_definitions(
5153
INTERFACE
5254
$<IF:$<CONFIG:Debug,DebugAssertions>,ZEND_DEBUG=1,ZEND_DEBUG=0>
5355
)
56+
57+
# Set CMAKE_<LANG>_FLAGS_<CONFIG> variables for the DebugAssertions build type.
58+
foreach(prefix CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_ASM_FLAGS)
59+
string(
60+
REGEX REPLACE
61+
"(-DNDEBUG|/DNDEBUG)"
62+
""
63+
${prefix}_DEBUGASSERTIONS
64+
"${${prefix}_RELWITHDEBINFO}"
65+
)
66+
endforeach()

cmake/cmake/Requirements.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ if(
8989
TYPE REQUIRED
9090
PURPOSE "Necessary to generate PHP parser files."
9191
)
92+
# TODO: Add Bison options based on the build type.
93+
#set(PHP_DEFAULT_BISON_FLAGS "-Wall $<$<CONFIG:Release,MinSizeRel>:-l>")
94+
set(PHP_DEFAULT_BISON_FLAGS "-Wall")
9295
endif()
9396

9497
# Check if re2c is required.
@@ -113,7 +116,11 @@ if(
113116
endif()
114117

115118
set(RE2C_ENABLE_DOWNLOAD TRUE)
116-
set(RE2C_DEFAULT_OPTIONS --no-generation-date)
119+
set(
120+
RE2C_DEFAULT_OPTIONS
121+
--no-generation-date # Suppress date output in the generated file.
122+
$<$<CONFIG:Release,MinSizeRel>:-i> # Do not output line directives.
123+
)
117124

118125
find_package(RE2C 1.0.3)
119126
set_package_properties(

cmake/cmake/modules/FindRE2C.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,11 @@ function(re2c_target)
260260

261261
list(APPEND outputs ${header})
262262

263-
# Before version 1.2 also --bit-vectors (-c) option is required when header
264-
# option is used.
263+
# When header option is used before version 1.2, also the '-c' option is
264+
# required. Before 1.1 -c long variant is '--start-conditions' and after 1.1
265+
# '--conditions'.
265266
if(RE2C_VERSION VERSION_LESS_EQUAL 1.2)
266-
list(APPEND options "--bit-vectors")
267+
list(APPEND options -c)
267268
endif()
268269

269270
# Since version 3.0, --header is the new alias option for --type-header.

cmake/ext/json/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ if(BISON_FOUND)
3131
php_json_parser
3232
json_parser.y
3333
${CMAKE_CURRENT_SOURCE_DIR}/json_parser.tab.c
34-
COMPILE_FLAGS "-Wall --defines -l"
34+
COMPILE_FLAGS "${PHP_DEFAULT_BISON_FLAGS}"
35+
VERBOSE REPORT_FILE json_parser.tab.output
3536
DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/json_parser.tab.h
3637
)
3738

@@ -45,6 +46,6 @@ if(RE2C_FOUND)
4546
json_scanner.re
4647
${CMAKE_CURRENT_SOURCE_DIR}/json_scanner.c
4748
HEADER ${CMAKE_CURRENT_SOURCE_DIR}/php_json_scanner_defs.h
48-
OPTIONS -bci
49+
OPTIONS -bc
4950
)
5051
endif()

cmake/sapi/phpdbg/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ if(BISON_FOUND)
192192
php_phpdbg_parser
193193
phpdbg_parser.y
194194
${CMAKE_CURRENT_SOURCE_DIR}/phpdbg_parser.c
195-
COMPILE_FLAGS "-Wall -d"
196-
VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR}/phpdbg_parser.output
195+
COMPILE_FLAGS "${PHP_DEFAULT_BISON_FLAGS}"
196+
VERBOSE REPORT_FILE phpdbg_parser.output
197197
DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/phpdbg_parser.h
198198
)
199199

0 commit comments

Comments
 (0)