From 7b0e05dea91f4d365ae93597a39132b6c0c1a3d9 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 | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libregexp.c b/libregexp.c index 3d29e5f..28af7a3 100644 --- a/libregexp.c +++ b/libregexp.c @@ -2066,7 +2066,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 5b7a9d6..5e01736 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 0b1678d..5c7edb7 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 { @@ -5019,7 +5019,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)