From c2ec127c0ae164d09d5952131dfaea9596e2c61d Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 22 Nov 2016 17:36:41 +0100 Subject: Warning for decls without name in composites. The warning missing declarations is now also triggered for declarations without name in field lists of composite types if the declaration is not an anonymous composite or a bitfield member. --- cparser/Elab.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cparser/Elab.ml') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 38ef7617..6188b482 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -759,7 +759,7 @@ and elab_field_group keep_ty env (Field_group (spec, fieldlist, loc)) = let fieldlist = List.map ( function - | (None, x) -> (Name ("", JUSTBASE, [], cabslu), x) + | (None, x) -> (Name ("", JUSTBASE, [], loc), x) | (Some n, x) -> (n, x)) fieldlist in @@ -812,6 +812,8 @@ and elab_field_group keep_ty env (Field_group (spec, fieldlist, loc)) = error loc "bit-field '%s' width not an integer constant" id; None end in + if id = "" && not (Cutil.is_anonymous_composite ty) && optbitsize = None then + warning loc Missing_declarations "declaration does not declare anything"; { fld_name = id; fld_typ = ty; fld_bitfield = optbitsize' } in (List.map2 elab_bitfield fieldlist names, env') -- cgit