Skip to content
Open
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
2 changes: 1 addition & 1 deletion Zend/Optimizer/zend_call_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct _zend_call_info {
bool is_prototype; /* An overridden child method may be called */
bool is_frameless; /* A frameless function sends arguments through operands */
uint32_t num_args; /* Number of arguments, excluding named and variadic arguments */
zend_send_arg_info arg_info[1];
zend_send_arg_info arg_info[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
};

struct _zend_func_info {
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ typedef struct _zend_trait_method_reference {
typedef struct _zend_trait_precedence {
zend_trait_method_reference trait_method;
uint32_t num_excludes;
zend_string *exclude_class_names[1];
zend_string *exclude_class_names[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_trait_precedence;

typedef struct _zend_trait_alias {
Expand Down Expand Up @@ -140,7 +140,7 @@ struct _zend_inheritance_cache_entry {
uint32_t dependencies_count;
uint32_t num_warnings;
zend_error_info **warnings;
zend_class_entry *traits_and_interfaces[1];
zend_class_entry *traits_and_interfaces[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
};

C23_ENUM(zend_class_type, uint8_t) {
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ struct _zend_ast {
zend_ast_kind kind; /* Type of the node (ZEND_AST_* enum constant) */
zend_ast_attr attr; /* Additional attribute, use depending on node type */
uint32_t lineno; /* Line number */
zend_ast *child[1]; /* Array of children (using struct hack) */
zend_ast *child[1] ZEND_ATTRIBUTE_FLEX_ARRAY; /* Array of children (using struct hack) */
};

/* Same as zend_ast, but with children count, which is updated dynamically */
Expand All @@ -197,7 +197,7 @@ typedef struct _zend_ast_list {
zend_ast_attr attr;
uint32_t lineno;
uint32_t children;
zend_ast *child[1];
zend_ast *child[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_ast_list;

/* Lineno is stored in val.u2.lineno */
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ typedef struct _zend_attribute {
* Everything else uses 0. */
uint32_t offset;
uint32_t argc;
zend_attribute_arg args[1];
zend_attribute_arg args[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_attribute;

typedef struct _zend_internal_attribute {
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_llist.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
typedef struct _zend_llist_element {
struct _zend_llist_element *next;
struct _zend_llist_element *prev;
char data[1]; /* Needs to always be last in the struct */
char data[1] ZEND_ATTRIBUTE_FLEX_ARRAY; /* Needs to always be last in the struct */
} zend_llist_element;

typedef void (*llist_dtor_func_t)(void *);
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_partial.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ typedef struct zp_names {
zend_string *variadic_param;
zend_string *extra_named_params;
zend_string *inner_closure;
zend_string *params[1]; /* argc elements */
zend_string *params[1] ZEND_ATTRIBUTE_FLEX_ARRAY; /* argc elements */
} zp_names;

static bool zp_name_exists(const zp_names *names, uint32_t argc, const zend_string *name)
Expand Down
6 changes: 6 additions & 0 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,12 @@ char *alloca();
# define HAVE_BUILTIN_CONSTANT_P
#endif

#if __has_attribute(strict_flex_array)
# define ZEND_ATTRIBUTE_FLEX_ARRAY __attribute__((strict_flex_array(1)))
#else
# define ZEND_ATTRIBUTE_FLEX_ARRAY
#endif

#if __has_attribute(counted_by)
#define ZEND_ELEMENT_COUNT(m) __attribute__((counted_by(m)))
#else
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_strtod.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ BCinfo { int dp0, dp1, dplen, dsign, e0, inexact, nd, nd0, rounding, scale, uflc
Bigint {
struct Bigint *next;
int k, maxwds, sign, wds;
ULong x[1];
ULong x[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
Comment thread
sebastianbergmann marked this conversation as resolved.
Resolved
};

typedef struct Bigint Bigint;
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ typedef struct {

typedef struct {
uint32_t num_types;
zend_type types[1];
zend_type types[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_type_list;

#define _ZEND_TYPE_EXTRA_FLAGS_SHIFT 25
Expand Down Expand Up @@ -380,7 +380,7 @@ struct _zend_string {
zend_refcounted_h gc;
zend_ulong h; /* hash value */
size_t len;
char val[1];
char val[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
};

typedef struct _Bucket {
Expand Down Expand Up @@ -604,7 +604,7 @@ struct _zend_object {
zend_class_entry *ce;
const zend_object_handlers *handlers;
HashTable *properties;
zval properties_table[1];
zval properties_table[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
};

struct _zend_resource {
Expand All @@ -617,7 +617,7 @@ struct _zend_resource {
typedef struct {
size_t num;
size_t num_allocated;
struct _zend_property_info *ptr[1];
struct _zend_property_info *ptr[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_property_info_list;

typedef union {
Expand Down
6 changes: 3 additions & 3 deletions ext/opcache/jit/zend_jit_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ typedef struct _zend_jit_op_array_hot_extension {
zend_func_info func_info;
const zend_op_array *op_array;
int16_t *counter;
zend_vm_opcode_handler_t orig_handlers[1];
zend_vm_opcode_handler_t orig_handlers[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_jit_op_array_hot_extension;

#define zend_jit_op_array_hash(op_array) \
Expand Down Expand Up @@ -352,7 +352,7 @@ typedef struct _zend_jit_op_array_trace_extension {
zend_func_info func_info;
const zend_op_array *op_array;
size_t offset; /* offset from "zend_op" to corresponding "op_info" */
zend_op_trace_info trace_info[1];
zend_op_trace_info trace_info[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} zend_jit_op_array_trace_extension;

#define ZEND_OP_TRACE_INFO(opline, offset) \
Expand Down Expand Up @@ -574,7 +574,7 @@ struct _zend_jit_trace_stack_frame {
int used_stack;
int old_checked_stack;
int old_peek_checked_stack;
zend_jit_trace_stack stack[1];
zend_jit_trace_stack stack[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
};

#define TRACE_FRAME_SHIFT_NUM_ARGS 16
Expand Down
2 changes: 1 addition & 1 deletion main/fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ typedef struct _fcgi_data_seg {
char *pos;
char *end;
struct _fcgi_data_seg *next;
char data[1];
char data[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} fcgi_data_seg;

typedef struct _fcgi_hash {
Expand Down
2 changes: 1 addition & 1 deletion sapi/phpdbg/phpdbg_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct {
size_t len;
zend_op_array op_array;
uint32_t lines;
uint32_t line[1];
uint32_t line[1] ZEND_ATTRIBUTE_FLEX_ARRAY;
} phpdbg_file_source;

#endif /* PHPDBG_LIST_H */
Loading