diff options
Diffstat (limited to 'cparser')
-rw-r--r-- | cparser/Elab.ml | 6 | ||||
-rw-r--r-- | cparser/Parser.vy | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 713ea04e..38ef7617 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -827,8 +827,10 @@ and elab_struct_or_union_info keep_ty kind loc env members attrs = if List.exists ((=) n) acc then error loc "duplicate member '%s'" n; n::acc - end else - acc) [] m); + end else begin + if Cutil.is_composite_type env fld.fld_typ then + warning loc Celeven_extension "anonymous structs/unions are a C11 extension"; + acc end) [] m); (* Check for incomplete types *) let rec check_incomplete = function | [] -> () diff --git a/cparser/Parser.vy b/cparser/Parser.vy index ab07cb94..3e175a37 100644 --- a/cparser/Parser.vy +++ b/cparser/Parser.vy @@ -451,7 +451,7 @@ struct_declaration: { Field_group (fst decspec) (rev' decls) (snd decspec) } (* Extension to C99 grammar needed to parse some GNU header files. *) | decspec = specifier_qualifier_list SEMICOLON - { Field_group (fst decspec) [] (snd decspec) } + { Field_group (fst decspec) [(None,None)] (snd decspec) } specifier_qualifier_list: | typ = type_specifier rest = specifier_qualifier_list |