aboutsummaryrefslogtreecommitdiff
path: root/odb/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-06-28 18:06:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-06-28 18:06:59 +0200
commit21fc3270c40e0623cee4363e00bb4435518a4bb7 (patch)
tree8d3d425699c4b91009d9dca6aef22c7d7353c42c /odb/parser.cxx
parent441e6f1b5901a5bde169f94930c6b42f6a2d5e05 (diff)
Handle anonymous union members
Diffstat (limited to 'odb/parser.cxx')
-rw-r--r--odb/parser.cxx19
1 files changed, 19 insertions, 0 deletions
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)));