Add warning

For example:
struct A {
int b [];
};
master
jiang 2014-05-09 22:35:19 +08:00
parent 0f51ccd4e4
commit 14d0aa450f
1 changed files with 2 additions and 0 deletions

View File

@ -3030,6 +3030,8 @@ static void struct_decl(CType *type, int u, int tdef)
skip(';');
}
skip('}');
if (!c && flexible)
tcc_error("flexible array member '%s' in otherwise empty struct", get_tok_str(v, NULL));
/* store size and alignment */
s->c = (c + maxalign - 1) & -maxalign;
s->r = maxalign;