This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]cp/decl.c: Can't forward reference anon enums
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH]cp/decl.c: Can't forward reference anon enums
- From: "Turly O'Connor" <turly at apple dot com>
- Date: Fri, 16 Mar 2001 14:57:56 -0800
- Cc: Stan Shebs <shebs at apple dot com>, turly at finderpop dot com
Hey there,
start_enum () in cp/decl.c tries to determine whether the enum now
being defined is the real definition of a previous forward reference.
This is not necessary if the enum now being defined is anonymous.
Apple's <Carbon.h> contains some 2100 such enums, and this patch
shaves 20% off the C++ parse time for it. YMMV, of course.
Sure an' happy st. paddy's day to yez, now!
--turly
2001-03-13 Turly O'Connor <turly@apple.com>
* cp/decl.c (start_enum): An anon enum cannot be the real
definition for a previous forward ref, so don't bother searching.
Index: decl.c
===================================================================
RCS file: /cvs/repository/CoreTools/gcc3/gcc/cp/decl.c,v
retrieving revision 1.1.1.6
diff -p -r1.1.1.6 decl.c
*** decl.c 2001/02/27 00:30:33 1.1.1.6
--- decl.c 2001/03/16 22:44:10
*************** start_enum (name)
*** 12854,12862 ****
/* If this is the real definition for a previous forward reference,
fill in the contents in the same object that used to be the
! forward reference. */
! if (name != NULL_TREE)
enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1);
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)
--- 12854,12863 ----
/* If this is the real definition for a previous forward reference,
fill in the contents in the same object that used to be the
! forward reference.
! Note that an anonymous enum cannot be forward-referenced. */
! if (name != NULL_TREE && !ANON_AGGRNAME_P (name))
enumtype = lookup_tag (ENUMERAL_TYPE, name, b, 1);
if (enumtype != NULL_TREE && TREE_CODE (enumtype) == ENUMERAL_TYPE)