This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: fix PR25982 (genconditions.c:write_writer)
- From: Joern RENNECKE <joern dot rennecke at st dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 26 Jan 2006 20:30:21 +0000
- Subject: RFA: fix PR25982 (genconditions.c:write_writer)
It turns out that in order to properly fix the SH pragmas, I need an
insn pattern with a condition that has quotes in it. The writer emitted
by gen_conditions:write_writer
fails to re-quote these quotes, thus resulting in a build failure. I
am currently bootstrapping the attached patch on i686-pc-linux-gnu.
2006-01-26 J"orn Rennecke <joern.rennecke@st.com>
* genconditions.c (write_writer): Fix emitted writer to
quote characters that need quoting. Add line number directive.
Index: genconditions.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L genconditions.c (revision 110178) -L genconditions.c (working copy) .svn/text-base/genconditions.c.svn-base genconditions.c
--- genconditions.c (revision 110178)
+++ genconditions.c (working copy)
@@ -163,13 +163,31 @@ static const struct c_test insn_conditio
static void
write_writer (void)
{
- puts ("int\nmain(void)\n{\n\
+#define stringify(a) stringify1(a)
+#define stringify1(a) #a
+ puts ("# "stringify(__LINE__) stringify(__FILE__)"\n\int\n\
+main(void)\n\
+{\n\
unsigned int i;\n\
+ const char *s;\n\
+ char c;\n\
\n\
puts (\"(define_conditions [\");\n\
for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n\
- printf (\" (%d \\\"%s\\\")\\n\",\n\
- insn_conditions[i].value, insn_conditions[i].expr);\n\
+ {\n\
+ printf (\" (%d \\\"\", insn_conditions[i].value);\n\
+ for (s = insn_conditions[i].expr; (c = *s++);)\n\
+ switch (c)\n\
+ {\n\
+ case \'\\t\': c = \'t\'; goto slash;
+ case \'\\n\': c = \'n\'; /* Fall through. */\n\
+ case \'\\\"\': case \'\\\'\': case \'\\\\\': slash:\n\
+ putchar(\'\\\\\'); /* Fall through. */\n\
+ default:\n\
+ putchar (c); break;\n\
+ }\n\
+ puts (\"\\\")\");\n\
+ }\n\
puts (\"])\");\n\
fflush (stdout);\n\
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);\n}");