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]

more ENABLE_CHECKING checks


Hi
This patch came handy when I was hunting the UNKNOWNs in flow.c - it makes
the gen_rtx_fmt_* check the format if ENABLE_CHECKING.

Honza

Tue Mar 13 11:52:59 CET 2001  Jan Hubicka  <jh@suse.cz>

	* gengenrtl.c (gendef): Generate runtime type checking for gen_rtx_fmt_*
	functions.

Index: egcs/gcc/gengenrtl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gengenrtl.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 gengenrtl.c
*** gengenrtl.c	2001/03/10 04:20:02	1.40
--- gengenrtl.c	2001/03/13 10:52:49
*************** gendef (format)
*** 321,326 ****
--- 321,331 ----
       the memory and initializes it.  */
    puts ("{");
    puts ("  rtx rt;");
+   puts ("#ifdef ENABLE_CHECKING");
+   printf ("  if (strcmp (\"%s\", GET_RTX_FORMAT (code)))\n", format);
+   printf ("    internal_error (\"gen_rtx_fmt_%s check: Code %%s have wrong format '%%s'\",\n", format);
+   puts ("                    GET_RTX_NAME (code), GET_RTX_FORMAT (code));");
+   puts ("#endif");
    printf ("  rt = ggc_alloc_rtx (%d);\n", (int) strlen (format));
  
    puts ("  memset (rt, 0, sizeof (struct rtx_def) - sizeof (rtunion));\n");
*************** gencode ()
*** 374,379 ****
--- 379,385 ----
    puts ("#include \"obstack.h\"");
    puts ("#include \"rtl.h\"");
    puts ("#include \"ggc.h\"\n");
+   puts ("#include \"errors.h\"\n");
    puts ("extern struct obstack *rtl_obstack;\n");
    puts ("#define obstack_alloc_rtx(n)					\\");
    puts ("    ((rtx) obstack_alloc (rtl_obstack,				\\");


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