fix: remove non-conforming size-0 arrays (#5564)

In C, these are supported only as a vendor extension; they should
instead use proper C99 flexible array members.

In C++, both `[]` and `[0]` are vendor extensions.

Co-authored-by: Thomas Köppe <tkoeppe@google.com>
This commit is contained in:
Eric Wieser 2024-10-01 16:05:17 +01:00 committed by GitHub
parent d4195c2605
commit e90c3cf15a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,7 +151,7 @@ typedef lean_object * b_lean_obj_res; /* Borrowed object result. */
typedef struct {
lean_object m_header;
lean_object * m_objs[0];
lean_object * m_objs[];
} lean_ctor_object;
/* Array arrays */
@ -159,7 +159,7 @@ typedef struct {
lean_object m_header;
size_t m_size;
size_t m_capacity;
lean_object * m_data[0];
lean_object * m_data[];
} lean_array_object;
/* Scalar arrays */
@ -167,7 +167,7 @@ typedef struct {
lean_object m_header;
size_t m_size;
size_t m_capacity;
uint8_t m_data[0];
uint8_t m_data[];
} lean_sarray_object;
typedef struct {
@ -175,7 +175,7 @@ typedef struct {
size_t m_size; /* byte length including '\0' terminator */
size_t m_capacity;
size_t m_length; /* UTF8 length */
char m_data[0];
char m_data[];
} lean_string_object;
typedef struct {
@ -183,7 +183,7 @@ typedef struct {
void * m_fun;
uint16_t m_arity; /* Number of arguments expected by m_fun. */
uint16_t m_num_fixed; /* Number of arguments that have been already fixed. */
lean_object * m_objs[0];
lean_object * m_objs[];
} lean_closure_object;
typedef struct {