Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ PHP 8.7 INTERNALS UPGRADE NOTES

- Removed zend_execute_scripts(). Manually call zend_execute_script() in a loop
instead.
- Removed ZEND_STATIC_ASSERT(). Use C11 static_assert() directly instead.

========================
2. Build system changes
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5944,7 +5944,7 @@ static void zend_compile_static_var_common(zend_string *var_name, zval *value, u
opline->op1_type = IS_CV;
opline->op1.var = lookup_cv(var_name);

ZEND_STATIC_ASSERT(sizeof(Bucket) % 8 == 0, "Bucket size not compatible with storing flags in lower three bits");
static_assert(sizeof(Bucket) % 8 == 0, "Bucket size not compatible with storing flags in lower three bits");
opline->extended_value = (uint32_t)((char*)value - (char*)CG(active_op_array)->static_variables->arData) | mode;
}
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_compile.h
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ struct _zend_execute_data {
(call)->This.u2.num_args

/* Ensure the correct alignment before slots calculation */
ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
static_assert(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
"zval must be aligned by ZEND_MM_ALIGNMENT");
/* A number of call frame slots (zvals) reserved for zend_execute_data. */
#define ZEND_CALL_FRAME_SLOT \
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ struct _zend_vm_stack {
};

/* Ensure the correct alignment before slots calculation */
ZEND_STATIC_ASSERT(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
static_assert(ZEND_MM_ALIGNED_SIZE(sizeof(zval)) == sizeof(zval),
"zval must be aligned by ZEND_MM_ALIGNMENT");
/* A number of call frame slots (zvals) reserved for _zend_vm_stack. */
#define ZEND_VM_STACK_HEADER_SLOTS \
Expand Down
8 changes: 0 additions & 8 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -862,14 +862,6 @@ extern "C++" {
/** @deprecated */
#define ZEND_CGG_DIAGNOSTIC_IGNORED_END ZEND_DIAGNOSTIC_IGNORED_END

#if defined(__cplusplus)
# define ZEND_STATIC_ASSERT(c, m) static_assert((c), m)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define ZEND_STATIC_ASSERT(c, m) _Static_assert((c), m)
#else
# define ZEND_STATIC_ASSERT(c, m)
#endif

#if !defined(ZEND_WIN32)
typedef max_align_t zend_max_align_t;
#else
Expand Down
4 changes: 2 additions & 2 deletions ext/date/time_duration.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#define NANOS_IN_MILLI 1000000
#define MILLIS_IN_SEC 1000

ZEND_STATIC_ASSERT(NANOS_IN_MICRO * MICROS_IN_SEC == NANOS_IN_SEC, "");
ZEND_STATIC_ASSERT(NANOS_IN_MILLI * MILLIS_IN_SEC == NANOS_IN_SEC, "");
static_assert(NANOS_IN_MICRO * MICROS_IN_SEC == NANOS_IN_SEC, "");
static_assert(NANOS_IN_MILLI * MILLIS_IN_SEC == NANOS_IN_SEC, "");

#define Z_PARAM_ULONG(l) { \
zend_long __##l; \
Expand Down
2 changes: 1 addition & 1 deletion ext/random/engine_mt19937.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
*/

#define N 624 /* length of state vector */
ZEND_STATIC_ASSERT(
static_assert(
N == sizeof(((php_random_status_state_mt19937*)0)->state) / sizeof(((php_random_status_state_mt19937*)0)->state[0]),
"Assumed length of Mt19937 state vector does not match actual size."
);
Expand Down
2 changes: 1 addition & 1 deletion ext/random/php_random_zend_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef struct php_random_bytes_insecure_state_for_zend {
php_random_status_state_xoshiro256starstar xoshiro256starstar_state;
} php_random_bytes_insecure_state_for_zend;

ZEND_STATIC_ASSERT(sizeof(zend_random_bytes_insecure_state) >= sizeof(php_random_bytes_insecure_state_for_zend), "");
static_assert(sizeof(zend_random_bytes_insecure_state) >= sizeof(php_random_bytes_insecure_state_for_zend), "");

ZEND_ATTRIBUTE_NONNULL PHPAPI void php_random_bytes_insecure_for_zend(
zend_random_bytes_insecure_state *state, void *bytes, size_t size);
Expand Down
Loading