This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH]cp/decl.c: Can't forward reference anon enums


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]