From 5a6dea3195ec0c6724c2ed524bf6f881f349eb51 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 23 Jun 2024 15:07:46 +0300 Subject: [PATCH] Use ISO C syntax for flexible array members --- libregexp.c | 2 +- quickjs-libc.c | 2 +- quickjs.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libregexp.c b/libregexp.c index a26b74c..99cb04f 100644 --- a/libregexp.c +++ b/libregexp.c @@ -2064,7 +2064,7 @@ typedef struct REExecState { size_t count; /* only used for RE_EXEC_STATE_GREEDY_QUANT */ const uint8_t *cptr; const uint8_t *pc; - void *buf[0]; + void *buf[]; } REExecState; typedef struct { diff --git a/quickjs-libc.c b/quickjs-libc.c index a594d74..140e6c3 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3231,7 +3231,7 @@ typedef struct { typedef struct { int ref_count; - uint64_t buf[0]; + uint64_t buf[]; } JSSABHeader; static JSClassID js_worker_class_id; diff --git a/quickjs.c b/quickjs.c index 978ade3..bdab68e 100644 --- a/quickjs.c +++ b/quickjs.c @@ -474,8 +474,8 @@ struct JSString { struct list_head link; /* string list */ #endif union { - uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */ - uint16_t str16[0]; + __extension__ uint8_t str8[0]; /* 8 bit strings will get an extra null terminator */ + __extension__ uint16_t str16[0]; } u; }; @@ -664,7 +664,7 @@ typedef struct JSBoundFunction { JSValue func_obj; JSValue this_val; int argc; - JSValue argv[0]; + JSValue argv[]; } JSBoundFunction; typedef enum JSIteratorKindEnum { @@ -822,7 +822,7 @@ typedef struct JSJobEntry { JSContext *ctx; JSJobFunc *job_func; int argc; - JSValue argv[0]; + JSValue argv[]; } JSJobEntry; typedef struct JSProperty { @@ -871,7 +871,7 @@ struct JSShape { int deleted_prop_count; JSShape *shape_hash_next; /* in JSRuntime.shape_hash[h] list */ JSObject *proto; - JSShapeProperty prop[0]; /* prop_size elements */ + JSShapeProperty prop[]; /* prop_size elements */ }; struct JSObject { @@ -5015,7 +5015,7 @@ typedef struct JSCFunctionDataRecord { uint8_t length; uint8_t data_len; uint16_t magic; - JSValue data[0]; + JSValue data[]; } JSCFunctionDataRecord; 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]; m1 = rme->module; index = js_inner_module_evaluation(ctx, m1, index, pstack_top, pvalue); - if (index < 0) + if (index < 0) return -1; assert(m1->status == JS_MODULE_STATUS_EVALUATING || m1->status == JS_MODULE_STATUS_EVALUATING_ASYNC ||