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: PATCH RFA: Don't test STATEMENT_CODE_P in add_stmt


Ian Lance Taylor wrote:
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?

OK.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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