From b0707daf4b32071d281c7aeaeccde391324d25f4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 25 Sep 2010 01:19:01 +0200 Subject: Wrap macro that expands to a type in () in casts --- odb/parser.cxx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'odb/parser.cxx') diff --git a/odb/parser.cxx b/odb/parser.cxx index ad740c4..d48d2a3 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -376,6 +376,24 @@ emit_class (tree c, path const& file, size_t line, size_t clmn, bool stub) if (bf && DECL_NAME (d) == 0) break; + // Another case where we can have NULL name is anonymous struct + // or union extension, for example: + // + // struct s + // { + // union + // { + // int a; + // int b; + // }; + // }; + // + // 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 (bf ? DECL_BIT_FIELD_TYPE (d) : TREE_TYPE (d)); char const* name (IDENTIFIER_POINTER (DECL_NAME (d))); @@ -1433,7 +1451,7 @@ create_type (tree t, // array doesn't specify bounds. In reality, both // low and high parts are set to HOST_WIDE_INT_MAX. // - if (hwl != ~HOST_WIDE_INT (0) && hwh != ~HOST_WIDE_INT (0)) + if (hwl != ~(HOST_WIDE_INT) (0) && hwh != ~(HOST_WIDE_INT) (0)) { unsigned long long l (hwl); unsigned long long h (hwh); @@ -1630,7 +1648,7 @@ emit_type_name (tree type, bool direct) HOST_WIDE_INT hwl (TREE_INT_CST_LOW (max)); HOST_WIDE_INT hwh (TREE_INT_CST_HIGH (max)); - if (hwl != ~HOST_WIDE_INT (0) && hwh != ~HOST_WIDE_INT (0)) + if (hwl != ~(HOST_WIDE_INT) (0) && hwh != ~(HOST_WIDE_INT) (0)) { unsigned long long l (hwl); unsigned long long h (hwh); -- cgit v1.1