From 33fd5b1e66bc0ad74c370a4ccb0b900ff1c07e59 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Thu, 11 Apr 2002 16:39:41 +0000 Subject: [PATCH] Revert previous patch. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52166 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ------ gcc/cp/decl.c | 31 +++---------------------------- gcc/testsuite/ChangeLog | 4 ---- gcc/testsuite/g++.dg/ext/attrib5.C | 27 --------------------------- 4 files changed, 3 insertions(+), 65 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/ext/attrib5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6f355c3..a2d8b8f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,9 +1,3 @@ -2002-04-11 Richard Sandiford - - * decl.c (duplicate_decls): Don't try to unify an implicit typedef - with an explicit one. - (lookup_tag): Extract the tag of an explicit typedef. - 2002-04-10 Nathan Sidwell PR c++/5507 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f55e1d4..dc9d373 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3426,18 +3426,6 @@ duplicate_decls (newdecl, olddecl) } } - /* Do not merge an implicit typedef with an explicit one. In: - - class A; - ... - typedef class A A __attribute__ ((foo)); - - the attribute should apply only to the typedef. */ - if (TREE_CODE (olddecl) == TYPE_DECL - && (DECL_IMPLICIT_TYPEDEF_P (olddecl) - || DECL_IMPLICIT_TYPEDEF_P (newdecl))) - return 0; - /* If new decl is `static' and an `extern' was seen previously, warn about it. */ warn_extern_redeclared_static (newdecl, olddecl); @@ -5348,23 +5336,10 @@ lookup_tag (form, name, binding_level, thislevel_only) else old = BINDING_TYPE (old); - /* If the declaration has an original type, it must a - typedef. When it is an explicit typedef of the form: - - typedef struct A A; - - the original type will be the tag that we want. - We should not return any other kind of typedef. - - Detect the valid case by checking that the original - type has the same name and context as the typedef. */ + /* If it has an original type, it is a typedef, and we + should not return it. */ if (old && DECL_ORIGINAL_TYPE (TYPE_NAME (old))) - { - old = DECL_ORIGINAL_TYPE (TYPE_NAME (old)); - if (TYPE_IDENTIFIER (old) != name - || context_for_name_lookup (TYPE_NAME (old)) != tail) - old = NULL_TREE; - } + old = NULL_TREE; if (old && TREE_CODE (old) != form && (form == ENUMERAL_TYPE || TREE_CODE (old) == ENUMERAL_TYPE)) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index eeb964a..93ef461 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,3 @@ -2002-04-11 Richard Sandiford - - * g++.dg/ext/attrib5.C: New test. - 2002-04-10 Janis Johnson * g77.f-torture/execute/6177.f: New test. diff --git a/gcc/testsuite/g++.dg/ext/attrib5.C b/gcc/testsuite/g++.dg/ext/attrib5.C deleted file mode 100644 index 4751193..0000000 --- a/gcc/testsuite/g++.dg/ext/attrib5.C +++ /dev/null @@ -1,27 +0,0 @@ -// There were two related problems here, depending on the vintage. At -// one time: -// -// typedef struct A { ... } A __attribute__ ((aligned (16))); -// -// would cause original_types to go into an infinite loop. At other -// times, the attributes applied to an explicit typedef would be lost -// (check_b2 would have a negative size). - -// First check that the declaration is accepted and has an effect. -typedef struct A { int i; } A __attribute__ ((aligned (16))); -int check_A[__alignof__ (A) >= 16 ? 1 : -1]; - -// Check that the alignment is only applied to the typedef. -struct B { int i; }; -namespace N { typedef B B; }; -typedef struct B B __attribute__((aligned (16))); -N::B b1; -B b2; -int check_b1[__alignof__ (b1) == __alignof__ (int) ? 1 : -1]; -int check_b2[__alignof__ (b2) >= 16 ? 1 : -1]; - -// The fix for this case involved a change to lookup_tag. This -// bit just checks against a possible regression. -namespace N { struct C; }; -typedef struct N::C C; // { dg-error "previous declaration" } -struct C; // { dg-error "conflicting types" } -- 2.7.4