From 14d0aa450f9a926a852ea01fbdecf27425264d14 Mon Sep 17 00:00:00 2001 From: jiang <30155751@qq.com> Date: Fri, 9 May 2014 22:35:19 +0800 Subject: [PATCH] Add warning For example: struct A { int b []; }; --- tccgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tccgen.c b/tccgen.c index 1a89d4a4..c37e27b4 100644 --- a/tccgen.c +++ b/tccgen.c @@ -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; -- 2.11.4.GIT