From 21fc3270c40e0623cee4363e00bb4435518a4bb7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 28 Jun 2011 18:06:59 +0200 Subject: Handle anonymous union members --- odb/parser.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'odb/parser.cxx') diff --git a/odb/parser.cxx b/odb/parser.cxx index 9bd8abc..09ee490 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -559,6 +559,25 @@ emit_union (tree u, path const& file, size_t line, size_t clmn, bool stub) } case FIELD_DECL: { + // We can have NULL name in case of anonymous struct or union + // extension, for example: + // + // union s + // { + // struct + // { + // int a; + // int b; + // }; + // int c; + // }; + // + // GCC appears to create a fake member for such a struct/union + // without any name. Ignore such members for now. + // + if (DECL_NAME (d) == 0) + break; + tree t (TREE_TYPE (d)); char const* name (IDENTIFIER_POINTER (DECL_NAME (d))); -- cgit v1.1