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]

PATCH RFA: Move STATEMENT_CODE_P into C++ frontend


STATEMENT_CODE_P is currently defined in the C/C++ common frontend,
but it is only used by the C++ frontend.  This patch moves it into the
C++ frontend.

Tested with bootstrap and testsuite run on i686-pc-linux-gnu.

OK for mainline?

Ian


./ChangeLog:
2005-05-11  Ian Lance Taylor  <ian@airs.com>

	* c-common.h (statement_code_p): Don't declare.
	(STATEMENT_CODE_P): Don't define.
	(INIT_STATEMENT_CODES): Don't define.
	* c-common.c (statement_code_p): Don't define.

cp/ChangeLog:
2005-05-11  Ian Lance Taylor  <ian@airs.com>

	* cp-tree.h (cp_stmt_codes): Don't define.
	(statement_code_p): Declare.
	(STATEMENT_CODE_P): Define.
	* lex.c (statement_code_p): Define.
	(cxx_init): Use actual codes in stmt_codes initializer, not
	cp_stmt_codes macro.  Initialize statement_code_p directly, rather
	than using INIT_STATEMENT_CODES.


Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.627
diff -p -u -r1.627 c-common.c
--- c-common.c	2 May 2005 16:02:10 -0000	1.627
+++ c-common.c	11 May 2005 09:56:16 -0000
@@ -191,11 +191,6 @@ cpp_reader *parse_in;		/* Declared in c-
 */
 
 tree c_global_trees[CTI_MAX];
-
-/* TRUE if a code represents a statement.  The front end init
-   langhook should take care of initialization of this array.  */
-
-bool statement_code_p[MAX_TREE_CODES];
 
 /* Switches common to the C front ends.  */
 
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.289
diff -p -u -r1.289 c-common.h
--- c-common.h	2 May 2005 04:21:55 -0000	1.289
+++ c-common.h	11 May 2005 09:56:16 -0000
@@ -735,20 +735,6 @@ enum c_tree_code {
 
 #undef DEFTREECODE
 
-/* TRUE if a code represents a statement.  The front end init
-   langhook should take care of initialization of this array.  */
-extern bool statement_code_p[MAX_TREE_CODES];
-
-#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
-
-#define INIT_STATEMENT_CODES(STMT_CODES)			\
-  do {								\
-    unsigned int i;						\
-    memset (&statement_code_p, 0, sizeof (statement_code_p));	\
-    for (i = 0; i < ARRAY_SIZE (STMT_CODES); i++)		\
-      statement_code_p[STMT_CODES[i]] = true;			\
-  } while (0)
-
 extern int stmts_are_full_exprs_p (void);
 extern int anon_aggr_type_p (tree);
 
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1135
diff -p -u -r1.1135 cp-tree.h
--- cp/cp-tree.h	4 May 2005 06:00:10 -0000	1.1135
+++ cp/cp-tree.h	11 May 2005 09:56:17 -0000
@@ -843,12 +843,11 @@ enum cplus_tree_code {
 };
 #undef DEFTREECODE
 
-#define cp_stmt_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
+/* TRUE if a tree code represents a statement.  */
+extern bool statement_code_p[MAX_TREE_CODES];
+
+#define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
+
 enum languages { lang_c, lang_cplusplus, lang_java };
 
 /* Macros to make error reporting functions' lives easier.  */
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.357
diff -p -u -r1.357 lex.c
--- cp/lex.c	3 May 2005 18:34:02 -0000	1.357
+++ cp/lex.c	11 May 2005 09:56:17 -0000
@@ -312,6 +312,10 @@ init_cp_pragma (void)
   c_register_pragma ("GCC", "java_exceptions", handle_pragma_java_exceptions);
 }
 
+/* TRUE if a code represents a statement.  */
+
+bool statement_code_p[MAX_TREE_CODES];
+
 /* Initialize the C++ front end.  This function is very sensitive to
    the exact order that things are done here.  It would be nice if the
    initialization done by this routine were moved to its subroutines,
@@ -319,11 +323,18 @@ init_cp_pragma (void)
 bool
 cxx_init (void)
 {
+  unsigned int i;
   static const enum tree_code stmt_codes[] = {
-    cp_stmt_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
   };
 
-  INIT_STATEMENT_CODES (stmt_codes);
+  memset (&statement_code_p, 0, sizeof (statement_code_p));
+  for (i = 0; i < ARRAY_SIZE (stmt_codes); i++)
+    statement_code_p[stmt_codes[i]] = true;
 
   /* We cannot just assign to input_filename because it has already
      been initialized and will be used later as an N_BINCL for stabs+


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