This is the mail archive of the 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]
Other format: [Raw text]

PATCH RFA: Clarify declares_class_or_enum in cp/parser.c

This minor patch changes a comment in cp/parser.c to clarify how
declares_class_or_enum is really used in
cp_parser_decl_specifier_seq().  The text is mostly copied from the
comment before cp_parser_type_specifier(), which is where
*declares_class_or_enum is actually set.

This patch also changes the setting of *declares_class_or_enum in
cp_parser_type_specifier() to use `0' rather than `false', since the
value is used as an integer, not a boolean.

Tested by rebuilding the compiler.

I came up with this patch while looking at the patch in PR c++/4100.
The patch in that PR uses declares_class_or_enum in a way which did
not match the comment in the code.  Further investigation showed me
that the comment was wrong, and I am fairly certain that the patch is
correct.  Somebody with authority should approve that patch, and this
one too.


2004-01-11  Ian Lance Taylor  <>

	* parser.c (cp_parser_decl_specifier_seq): Correct comment
	describing declares_class_or_enum.
	(cp_parser_type_specifier): Set *declares_class_or_enum to 0, not

Index: parser.c
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.149
diff -p -u -r1.149 parser.c
--- parser.c	11 Jan 2004 20:33:35 -0000	1.149
+++ parser.c	12 Jan 2004 00:51:08 -0000
@@ -6527,12 +6527,10 @@ cp_parser_simple_declaration (cp_parser*
    even if *FRIEND_IS_NOT_CLASS_P is FALSE, the entity to which
    friendship is granted might not be a class.  
-   *DECLARES_CLASS_OR_ENUM is set to the bitwise or of the following
-   *flags:
-     1: one of the decl-specifiers is an elaborated-type-specifier
-     2: one of the decl-specifiers is an enum-specifier or a
-        class-specifier
+   If the type includes a class-specifier, enum-specifier, or
+   elaborated-type-specifier, *DECLARES_CLASS_OR_ENUM is set to a
+   nonzero value.  The value is 1 if a type is declared; 2 if it is
+   defined.  Otherwise, *DECLARES_CLASS_OR_ENUM is set to zero.
@@ -8514,7 +8512,7 @@ cp_parser_type_specifier (cp_parser* par
   /* Assume this type-specifier does not declare a new type.  */
   if (declares_class_or_enum)
-    *declares_class_or_enum = false;
+    *declares_class_or_enum = 0;
   /* And that it does not specify a cv-qualifier.  */
   if (is_cv_qualifier)
     *is_cv_qualifier = false;

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