Skip to content

Commit 56d1522

Browse files
ondrejmirtesclaude
andcommitted
Keep php-src's -Wassume suppression past the engine header scope
zend_portability.h silences -Wassume for the rest of the translation unit with a pragma: under clang ZEND_ASSERT is __builtin_assume, and the Z_PARAM_* macros expand it, at the caller's site, over expressions with potential side effects. support.h includes the engine headers inside a diagnostic push/pop, and the pop discarded that pragma along with our own exemptions, re-enabling the warning for every Z_PARAM_* expansion in the extension. CI's strict set covered it with -Wno-assume; the lenient local build did not, so a clean clang build printed ~95,000 warnings (2.28M lines), burying any real one and taking 217s instead of 42s at -j10. support.h now restores the pragma after the pop, and -Wno-assume leaves the strict set. A clean build is warning-free under both the lenient flags and the strict ones, and the resulting .so is byte-identical. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CmttmeH2WqiTdVc9HGHBNL
1 parent efaa82a commit 56d1522

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎turbo-ext/Makefile‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ UNAME_S := $(shell uname -s)
2222
SIZE_FLAGS := -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sections -fdata-sections
2323
# The strict set the CI compile legs build with, defined once here and read
2424
# by the workflows (`make -s print-warn-flags`) instead of being spelled out
25-
# in each of them. The three -Wno- exemptions cover third-party macro
25+
# in each of them. The two -Wno- exemptions cover third-party macro
2626
# expansions, never our own code:
27-
# -Wno-assume zend's parameter-parsing macros expand
28-
# __builtin_assume with (potential) side effects
2927
# -Wno-unused-parameter PHP_METHOD's fixed signature — execute_data and
3028
# return_value are not used by every method
3129
# -Wno-unicode zend arginfo macros stringify namespaced class
@@ -48,7 +46,7 @@ SIZE_FLAGS := -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sect
4846
# shared const empty array to zend_array *. Not ours to fix.
4947
# -Wzero-as-null-pointer-constant 3 sites; not worth a gate on its own.
5048
STRICT_WARN_FLAGS := -Wall -Wextra -Werror \
51-
-Wno-assume -Wno-unused-parameter -Wno-unicode \
49+
-Wno-unused-parameter -Wno-unicode \
5250
-Wsuggest-override -Wnon-virtual-dtor -Wdouble-promotion -Wextra-semi
5351
# A plain local build stays lenient on purpose: a contributor's compiler may
5452
# warn where the versions CI pins do not, and -Werror would turn that into a

‎turbo-ext/src/support.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ extern "C" {
4545
#undef max
4646
#endif
4747

48+
/* zend_portability.h silences -Wassume for the rest of the translation unit:
49+
* under clang ZEND_ASSERT is __builtin_assume, and the Z_PARAM_* macros
50+
* expanding it in our code assume expressions with potential side effects.
51+
* The pop above discarded that along with our own exemptions — restore it. */
52+
#if defined(__clang__)
53+
#pragma clang diagnostic ignored "-Wassume"
54+
#endif
55+
4856
/* {{{ configurable class references */
4957

5058
typedef struct _pt_class_ref {

0 commit comments

Comments
 (0)