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]
Other format: [Raw text]

Re: tcc_statement vs. tcc_expression in the C++ frontend


Ian Lance Taylor <ian@airs.com> writes:

> Anyhow, I'm testing the obvious patch to use tcc_statement instead of
> tcc_expression in cp-tree.def, and I will submit it to gcc-patches if
> it works.  At the moment I'm curious as to whether anybody has a
> reason why these codes should be tcc_expression rather than
> tcc_statement.

This patch has been tested by bootstrap and g++ and libstdc++
testsuite run on i686-pc-linux-gnu.  OK for mainline?

Ian


2005-04-23  Ian Lance Taylor  <ian@c2micro.com>

	* cp-tree.def (USING_STMT): Change class to tcc_statement.
	(TRY_BLOCK, EH_SPEC_BLOCK, HANDLER, CLEANUP_STMT): Likewise.
	(IF_STMT, FOR_STMT, WHILE_STMT, DO_STMT): Likewise.
	(BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.


Index: cp/cp-tree.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.def,v
retrieving revision 1.99
diff -u -r1.99 cp-tree.def
--- cp/cp-tree.def	20 Apr 2005 19:59:14 -0000	1.99
+++ cp/cp-tree.def	23 Apr 2005 20:30:16 -0000
@@ -204,7 +204,7 @@
 DEFTREECODE (USING_DECL, "using_decl", tcc_declaration, 0)
 
 /* A using directive. The operand is USING_STMT_NAMESPACE.  */     
-DEFTREECODE (USING_STMT, "using_directive", tcc_expression, 1)
+DEFTREECODE (USING_STMT, "using_directive", tcc_statement, 1)
 
 /* An un-parsed default argument.  Looks like an IDENTIFIER_NODE.  */
 DEFTREECODE (DEFAULT_ARG, "default_arg", tcc_exceptional, 0)
@@ -258,15 +258,15 @@
    setup_vtbl_pointer (and appears in all functions, not just ctors).  */
 DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", tcc_expression, 1)
 
-DEFTREECODE (TRY_BLOCK, "try_block", tcc_expression, 2)
+DEFTREECODE (TRY_BLOCK, "try_block", tcc_statement, 2)
 
-DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", tcc_expression, 2)
+DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", tcc_statement, 2)
 
 /* A HANDLER wraps a catch handler for the HANDLER_TYPE.  If this is
    CATCH_ALL_TYPE, then the handler catches all types.  The declaration of
    the catch variable is in HANDLER_PARMS, and the body block in
    HANDLER_BODY.  */
-DEFTREECODE (HANDLER, "handler", tcc_expression, 2)
+DEFTREECODE (HANDLER, "handler", tcc_statement, 2)
 
 /* A MUST_NOT_THROW_EXPR wraps an expression that may not
    throw, and must call terminate if it does.  */
@@ -275,35 +275,35 @@
 /* A CLEANUP_STMT marks the point at which a declaration is fully
    constructed.  The CLEANUP_EXPR is run on behalf of CLEANUP_DECL
    when CLEANUP_BODY completes.  */
-DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_expression, 3)
+DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_statement, 3)
 
 /* Represents an 'if' statement. The operands are IF_COND,
    THEN_CLAUSE, and ELSE_CLAUSE, respectively.  */
 /* ??? It is currently still necessary to distinguish between IF_STMT 
    and COND_EXPR for the benefit of templates.  */
-DEFTREECODE (IF_STMT, "if_stmt", tcc_expression, 3)
+DEFTREECODE (IF_STMT, "if_stmt", tcc_statement, 3)
 
 /* Used to represent a `for' statement. The operands are
    FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively.  */
-DEFTREECODE (FOR_STMT, "for_stmt", tcc_expression, 4)
+DEFTREECODE (FOR_STMT, "for_stmt", tcc_statement, 4)
 
 /* Used to represent a 'while' statement. The operands are WHILE_COND
    and WHILE_BODY, respectively.  */
-DEFTREECODE (WHILE_STMT, "while_stmt", tcc_expression, 2)
+DEFTREECODE (WHILE_STMT, "while_stmt", tcc_statement, 2)
 
 /* Used to represent a 'do' statement. The operands are DO_BODY and
    DO_COND, respectively.  */
-DEFTREECODE (DO_STMT, "do_stmt", tcc_expression, 2)
+DEFTREECODE (DO_STMT, "do_stmt", tcc_statement, 2)
 
 /* Used to represent a 'break' statement.  */
-DEFTREECODE (BREAK_STMT, "break_stmt", tcc_expression, 0)
+DEFTREECODE (BREAK_STMT, "break_stmt", tcc_statement, 0)
 
 /* Used to represent a 'continue' statement.  */
-DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_expression, 0)
+DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_statement, 0)
 
 /* Used to represent a 'switch' statement. The operands are
    SWITCH_STMT_COND, SWITCH_STMT_BODY and SWITCH_STMT_TYPE, respectively.  */
-DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_expression, 3)
+DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_statement, 3)
 
 DEFTREECODE (TAG_DEFN, "tag_defn", tcc_expression, 0)
 


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