diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-30 22:26:48 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-30 22:26:48 +0000 |
commit | 316e17aef38913850104bf635ecbda834f7584ea (patch) | |
tree | f4d65d8bd351d2fdf24edc0ee51fdb6998ce6afc | |
parent | 01142df59a6d0394291b5efcac73e79480993f08 (diff) | |
download | gcc-316e17aef38913850104bf635ecbda834f7584ea.tar.gz |
PR c++/14587
* config/i386/winnt.c (associated_type): Look for attributes on
the TYPE_MAIN_VARIANT of *this.
* attribs.c (decl_attributes): If ATTR_FLAG_TYPE_IN_PLACE, also
apply the attributes to the variants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81369 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/attribs.c | 21 | ||||
-rw-r--r-- | gcc/config/i386/winnt.c | 3 |
3 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b24e85876fb..311728e4d55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-04-30 Jason Merrill <jason@redhat.com> + + PR c++/14587 + * config/i386/winnt.c (associated_type): Look for attributes on + the TYPE_MAIN_VARIANT of *this. + * attribs.c (decl_attributes): If ATTR_FLAG_TYPE_IN_PLACE, also + apply the attributes to the variants. + 2004-04-30 Paul Brook <paul@codesourcery.com> * config.gcc: Simplify arm --with-{cpu,tune} test. diff --git a/gcc/attribs.c b/gcc/attribs.c index 5d8450ff601..671528ccacd 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -294,7 +294,26 @@ decl_attributes (tree *node, tree attributes, int flags) if (DECL_P (*anode)) DECL_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs); else if (flags & (int) ATTR_FLAG_TYPE_IN_PLACE) - TYPE_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs); + { + TYPE_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs); + /* If this is the main variant, also push the attributes + out to the other variants. */ + if (*anode == TYPE_MAIN_VARIANT (*anode)) + { + tree variant; + for (variant = *anode; variant; + variant = TYPE_NEXT_VARIANT (variant)) + { + if (TYPE_ATTRIBUTES (variant) == old_attrs) + TYPE_ATTRIBUTES (variant) + = TYPE_ATTRIBUTES (*anode); + else if (!lookup_attribute + (spec->name, TYPE_ATTRIBUTES (variant))) + TYPE_ATTRIBUTES (variant) = tree_cons + (name, args, TYPE_ATTRIBUTES (variant)); + } + } + } else *anode = build_type_attribute_variant (*anode, tree_cons (name, args, diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index b97810a67ed..6196d32aa6f 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -171,7 +171,8 @@ associated_type (tree decl) dtor's are not affected by class status but virtual and non-virtual thunks are. */ if (!DECL_ARTIFICIAL (decl) || DECL_COMDAT (decl)) - t = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))); + t = TYPE_MAIN_VARIANT + (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))))); } else if (DECL_CONTEXT (decl) && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't') |