Skip to content

Commit b8f10de

Browse files
authored
ZEND_ELEMENT_COUNT usage reduction. (#13324)
clang 18 is going to be released and in the meantime the counted_by attribute usage had been constrained to true flexible arrays, typical cases such as type name[1] ZEND_ELEMENT_COUNT(size) no longer build.
1 parent 9628ca7 commit b8f10de

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

Zend/Optimizer/zend_call_graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct _zend_call_info {
3939
bool named_args; /* Function has named arguments */
4040
bool is_prototype; /* An overridden child method may be called */
4141
int num_args; /* Number of arguments, excluding named and variadic arguments */
42-
zend_send_arg_info arg_info[1] ZEND_ELEMENT_COUNT(num_args);
42+
zend_send_arg_info arg_info[1];
4343
};
4444

4545
struct _zend_func_info {

Zend/zend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ typedef struct _zend_trait_method_reference {
9595
typedef struct _zend_trait_precedence {
9696
zend_trait_method_reference trait_method;
9797
uint32_t num_excludes;
98-
zend_string *exclude_class_names[1] ZEND_ELEMENT_COUNT(num_excludes);
98+
zend_string *exclude_class_names[1];
9999
} zend_trait_precedence;
100100

101101
typedef struct _zend_trait_alias {

Zend/zend_ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ typedef struct _zend_ast_list {
191191
zend_ast_attr attr;
192192
uint32_t lineno;
193193
uint32_t children;
194-
zend_ast *child[1] ZEND_ELEMENT_COUNT(children);
194+
zend_ast *child[1];
195195
} zend_ast_list;
196196

197197
/* Lineno is stored in val.u2.lineno */

Zend/zend_attributes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct _zend_attribute {
5858
/* Parameter offsets start at 1, everything else uses 0. */
5959
uint32_t offset;
6060
uint32_t argc;
61-
zend_attribute_arg args[1] ZEND_ELEMENT_COUNT(argc);
61+
zend_attribute_arg args[1];
6262
} zend_attribute;
6363

6464
typedef struct _zend_internal_attribute {

Zend/zend_types.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ typedef struct {
139139

140140
typedef struct {
141141
uint32_t num_types;
142-
zend_type types[1] ZEND_ELEMENT_COUNT(num_types);
142+
zend_type types[1];
143143
} zend_type_list;
144144

145145
#define _ZEND_TYPE_EXTRA_FLAGS_SHIFT 25
@@ -374,7 +374,7 @@ struct _zend_string {
374374
zend_refcounted_h gc;
375375
zend_ulong h; /* hash value */
376376
size_t len;
377-
char val[1] ZEND_ELEMENT_COUNT(len);
377+
char val[1];
378378
};
379379

380380
typedef struct _Bucket {
@@ -572,7 +572,7 @@ struct _zend_resource {
572572
typedef struct {
573573
size_t num;
574574
size_t num_allocated;
575-
struct _zend_property_info *ptr[1] ZEND_ELEMENT_COUNT(num);
575+
struct _zend_property_info *ptr[1];
576576
} zend_property_info_list;
577577

578578
typedef union {

ext/fileinfo/libmagic/cdf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ typedef struct {
277277

278278
typedef struct {
279279
size_t cat_num;
280-
cdf_catalog_entry_t cat_e[1] ZEND_ELEMENT_COUNT(cat_num);
280+
cdf_catalog_entry_t cat_e[1];
281281
} cdf_catalog_t;
282282

283283
struct timespec;

ext/opcache/jit/zend_jit_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ struct _zend_jit_trace_stack_frame {
540540
int used_stack;
541541
int old_checked_stack;
542542
int old_peek_checked_stack;
543-
zend_jit_trace_stack stack[1] ZEND_ELEMENT_COUNT(used_stack);
543+
zend_jit_trace_stack stack[1];
544544
};
545545

546546
#define TRACE_FRAME_SHIFT_NUM_ARGS 16

sapi/phpdbg/phpdbg_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef struct {
4444
size_t len;
4545
zend_op_array op_array;
4646
uint32_t lines;
47-
uint32_t line[1] ZEND_ELEMENT_COUNT(lines);
47+
uint32_t line[1];
4848
} phpdbg_file_source;
4949

5050
#endif /* PHPDBG_LIST_H */

0 commit comments

Comments
 (0)