This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH RFA: Don't test STATEMENT_CODE_P in add_stmt
- From: Ian Lance Taylor <ian at airs dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 27 Apr 2005 09:51:59 -0400
- Subject: PATCH RFA: Don't test STATEMENT_CODE_P in add_stmt
The function add_stmt in the shared C/C++ frontend has this
conditional in it:
if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
EXPR_P is true for any tree code of class tcc_statement or
tcc_expression, among others. STATEMENT_CODE_P will only return true
in the C++ frontend, for this list of codes:
CTOR_INITIALIZER, TRY_BLOCK, HANDLER, \
EH_SPEC_BLOCK, USING_STMT, TAG_DEFN, \
IF_STMT, CLEANUP_STMT, FOR_STMT, \
WHILE_STMT, DO_STMT, BREAK_STMT, \
CONTINUE_STMT, SWITCH_STMT, EXPR_STMT
Those codes all have class tcc_statement or tcc_expression. Therefore
EXPR_P will always return true for them, and the test of
STATEMENT_CODE_P is unnecessary. It seems very unlikely that
STATEMENT_CODE_P will ever return true for something which is not
tcc_statement or tcc_expression.
This obvious patch removes the test of STATEMENT_CODE_P. Tested with
bootstrap and testsuite run on i686-pc-linux-gnu. OK for mainline?
Ian
2005-04-27 Ian Lance Taylor <ian@airs.com>
* c-semantics.c (add_stmt): Don't test STATEMENT_CODE_P
Index: c-semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-semantics.c,v
retrieving revision 1.97
diff -p -u -r1.97 c-semantics.c
--- c-semantics.c 25 Apr 2005 01:18:23 -0000 1.97
+++ c-semantics.c 27 Apr 2005 13:13:31 -0000
@@ -108,7 +108,7 @@ add_stmt (tree t)
{
enum tree_code code = TREE_CODE (t);
- if ((EXPR_P (t) || STATEMENT_CODE_P (code)) && code != LABEL_EXPR)
+ if (EXPR_P (t) && code != LABEL_EXPR)
{
if (!EXPR_HAS_LOCATION (t))
SET_EXPR_LOCATION (t, input_location);