I have an issue with SDCC. My code (which I am attempting to port from another compiler) uses structs with flexible array members. However, when I try to compile the following code:
/** header of string list */
typedef struct {
int nCount;
int nMemUsed;
int nMemAvail;
} STRLIST_HEADER;
/** string list entry data type */
typedef struct {
int nLen;
char str[];
} STRLIST_ENTRY;
/** string list data type */
typedef struct {
STRLIST_HEADER header;
STRLIST_ENTRY entry[];
} STRLIST; // By the way, this is the line the error refers to.
int main()
{
return 0;
}
SDCC gives the following error:
$ sdcc -mz80 -S --std-c99 test.c
test.c:18: warning 186: invalid use of structure with flexible array member
test.c:18: error 200: field 'entry' has incomplete type
What gives? This code compiles just fine in gcc, not to mention the other z80 compiler I'm using.
EDIT: I found this SDCC bug which seems to be related. Could someone explain if it is and how?