diff mbox

[6/9] ENABLE_CHECKING refactoring: generators

Message ID 561308F8.20805@gmail.com
State New
Headers show

Commit Message

Mikhail Maltsev Oct. 5, 2015, 11:34 p.m. UTC
gcc/ChangeLog:

2015-10-05  Mikhail Maltsev  <maltsevm@gmail.com>

	* genautomata.c: Use CHECKING_P instead of ENABLE_CHECKING.
	* genconditions.c: Define CHECKING_P in generated code.
	* genextract.c: Use CHECKING_P instead of ENABLE_CHECKING.
	* gengtype.c (main): Likewise.
	* gengtype.h: Likewise.

Comments

Richard Biener Oct. 6, 2015, 12:56 p.m. UTC | #1
On Tue, Oct 6, 2015 at 1:34 AM, Mikhail Maltsev <maltsevm@gmail.com> wrote:
> gcc/ChangeLog:
>
> 2015-10-05  Mikhail Maltsev  <maltsevm@gmail.com>
>
>         * genautomata.c: Use CHECKING_P instead of ENABLE_CHECKING.
>         * genconditions.c: Define CHECKING_P in generated code.
>         * genextract.c: Use CHECKING_P instead of ENABLE_CHECKING.
>         * gengtype.c (main): Likewise.
>         * gengtype.h: Likewise.

The generators should simply unconditionally check (not in generated
files, of course).
And the generated code parts should use flag_checking.

Richard.

>
diff mbox

Patch

From 88463ec3319670875dfe47926f6e55d5fd6219ba Mon Sep 17 00:00:00 2001
From: Mikhail Maltsev <maltsevm@gmail.com>
Date: Sun, 4 Oct 2015 22:50:02 +0300
Subject: [PATCH 6/9] Generators

---
 gcc/genautomata.c   | 2 +-
 gcc/genconditions.c | 2 ++
 gcc/genextract.c    | 2 +-
 gcc/gengtype.c      | 8 +++-----
 gcc/gengtype.h      | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index 5196d68..beae5ef 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -879,7 +879,7 @@  struct state_ainsn_table
 /* Macros to access members of unions.  Use only them for access to
    union members of declarations and regexps.  */
 
-#if defined ENABLE_CHECKING && (GCC_VERSION >= 2007)
+#if CHECKING_P && (GCC_VERSION >= 2007)
 
 #define DECL_UNIT(d) __extension__					\
 (({ __typeof (d) const _decl = (d);					\
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index 001e58e..7481ab4 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -60,6 +60,8 @@  write_header (void)
 \n\
 /* Do not allow checking to confuse the issue.  */\n\
 #undef ENABLE_CHECKING\n\
+#undef CHECKING_P\n\
+#define CHECKING_P 0\n\
 #undef ENABLE_TREE_CHECKING\n\
 #undef ENABLE_RTL_CHECKING\n\
 #undef ENABLE_RTL_FLAG_CHECKING\n\
diff --git a/gcc/genextract.c b/gcc/genextract.c
index fe97701..7f1879f 100644
--- a/gcc/genextract.c
+++ b/gcc/genextract.c
@@ -373,7 +373,7 @@  insn_extract (rtx_insn *insn)\n{\n\
   rtx pat = PATTERN (insn);\n\
   int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\
 \n\
-#ifdef ENABLE_CHECKING\n\
+#if CHECKING_P\n\
   memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\
   memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\
 #endif\n");
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 866d809..777b52f 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -160,7 +160,7 @@  static outf_p *base_files;
 
 
 
-#if ENABLE_CHECKING
+#if CHECKING_P
 /* Utility debugging function, printing the various type counts within
    a list of types.  Called through the DBGPRINT_COUNT_TYPE macro.  */
 void
@@ -222,7 +222,7 @@  dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
     fprintf (stderr, "@@%%@@ %d undefined types\n", nb_undefined);
   fprintf (stderr, "\n");
 }
-#endif /* ENABLE_CHECKING */
+#endif /* CHECKING_P */
 
 /* Scan the input file, LIST, and determine how much space we need to
    store strings in.  Also, count the number of language directories
@@ -5181,15 +5181,13 @@  main (int argc, char **argv)
 
   parse_program_options (argc, argv);
 
-#if ENABLE_CHECKING
-  if (do_debug)
+  if (CHECKING_P && do_debug)
     {
       time_t now = (time_t) 0;
       time (&now);
       DBGPRINTF ("gengtype started pid %d at %s",
 		 (int) getpid (), ctime (&now));
     }
-#endif	/* ENABLE_CHECKING */
 
   /* Parse the input list and the input files.  */
   DBGPRINTF ("inputlist %s", inputlist);
diff --git a/gcc/gengtype.h b/gcc/gengtype.h
index 83f3632..9c4eac3 100644
--- a/gcc/gengtype.h
+++ b/gcc/gengtype.h
@@ -492,7 +492,7 @@  extern int do_dump;		/* (-d) program argument. */
    gengtype source code).  Only useful to debug gengtype itself.  */
 extern int do_debug;		/* (-D) program argument. */
 
-#if ENABLE_CHECKING
+#if CHECKING_P
 #define DBGPRINTF(Fmt,...) do {if (do_debug)				\
       fprintf (stderr, "%s:%d: " Fmt "\n",				\
 	       lbasename (__FILE__),__LINE__, ##__VA_ARGS__);} while (0)
@@ -502,7 +502,7 @@  void dbgprint_count_type_at (const char *, int, const char *, type_p);
 #else
 #define DBGPRINTF(Fmt,...) do {/*nodbgrintf*/} while (0)
 #define DBGPRINT_COUNT_TYPE(Msg,Ty) do{/*nodbgprint_count_type*/}while (0)
-#endif /*ENABLE_CHECKING */
+#endif /* CHECKING_P */
 
 #define FOR_ALL_INHERITED_FIELDS(TYPE, FIELD_VAR) \
   for (type_p sub = (TYPE); sub; sub = sub->u.s.base_class) \
-- 
2.1.4