Use ISO C syntax for flexible array members

This commit is contained in:
Andrew Johnson 2024-06-23 15:07:46 +03:00
parent 2ea0848616
commit 5a6dea3195
3 changed files with 9 additions and 9 deletions

View file

@ -2064,7 +2064,7 @@ typedef struct REExecState {
size_t count; /* only used for RE_EXEC_STATE_GREEDY_QUANT */ size_t count; /* only used for RE_EXEC_STATE_GREEDY_QUANT */
const uint8_t *cptr; const uint8_t *cptr;
const uint8_t *pc; const uint8_t *pc;
void *buf[0]; void *buf[];
} REExecState; } REExecState;
typedef struct { typedef struct {

View file

@ -3231,7 +3231,7 @@ typedef struct {
typedef struct { typedef struct {
int ref_count; int ref_count;
uint64_t buf[0]; uint64_t buf[];
} JSSABHeader; } JSSABHeader;
static JSClassID js_worker_class_id; static JSClassID js_worker_class_id;

View file

@ -474,8 +474,8 @@ struct JSString {
struct list_head link; /* string list */ struct list_head link; /* string list */
#endif #endif
union { union {
uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */ __extension__ uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */
uint16_t str16[0]; __extension__ uint16_t str16[0];
} u; } u;
}; };
@ -664,7 +664,7 @@ typedef struct JSBoundFunction {
JSValue func_obj; JSValue func_obj;
JSValue this_val; JSValue this_val;
int argc; int argc;
JSValue argv[0]; JSValue argv[];
} JSBoundFunction; } JSBoundFunction;
typedef enum JSIteratorKindEnum { typedef enum JSIteratorKindEnum {
@ -822,7 +822,7 @@ typedef struct JSJobEntry {
JSContext *ctx; JSContext *ctx;
JSJobFunc *job_func; JSJobFunc *job_func;
int argc; int argc;
JSValue argv[0]; JSValue argv[];
} JSJobEntry; } JSJobEntry;
typedef struct JSProperty { typedef struct JSProperty {
@ -871,7 +871,7 @@ struct JSShape {
int deleted_prop_count; int deleted_prop_count;
JSShape *shape_hash_next; /* in JSRuntime.shape_hash[h] list */ JSShape *shape_hash_next; /* in JSRuntime.shape_hash[h] list */
JSObject *proto; JSObject *proto;
JSShapeProperty prop[0]; /* prop_size elements */ JSShapeProperty prop[]; /* prop_size elements */
}; };
struct JSObject { struct JSObject {
@ -5015,7 +5015,7 @@ typedef struct JSCFunctionDataRecord {
uint8_t length; uint8_t length;
uint8_t data_len; uint8_t data_len;
uint16_t magic; uint16_t magic;
JSValue data[0]; JSValue data[];
} JSCFunctionDataRecord; } JSCFunctionDataRecord;
static void js_c_function_data_finalizer(JSRuntime *rt, JSValue val) static void js_c_function_data_finalizer(JSRuntime *rt, JSValue val)
@ -27371,7 +27371,7 @@ static int js_inner_module_evaluation(JSContext *ctx, JSModuleDef *m,
JSReqModuleEntry *rme = &m->req_module_entries[i]; JSReqModuleEntry *rme = &m->req_module_entries[i];
m1 = rme->module; m1 = rme->module;
index = js_inner_module_evaluation(ctx, m1, index, pstack_top, pvalue); index = js_inner_module_evaluation(ctx, m1, index, pstack_top, pvalue);
if (index < 0) if (index < 0)
return -1; return -1;
assert(m1->status == JS_MODULE_STATUS_EVALUATING || assert(m1->status == JS_MODULE_STATUS_EVALUATING ||
m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC || m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||