diff mbox

RFA: Fix rtl-optimization/44752

Message ID 20100712025447.bk905yd5u8cww40c-nzlynne@webmail.spamcop.net
State New
Headers show

Commit Message

Joern Rennecke July 12, 2010, 6:54 a.m. UTC
Instead of inventing some random typedef or symbol, which could cause name
clashes, or using an explicit forward declration of  an existing struct,
which could bitrot when this is ever changed to a union or something else,
I include two common gcc header files that are also used in the other
code path; system.h, which at least declares fancy_abort, and before that
config.h, so that we get consistent declarations when all translation units
are considered.

Tested by building all-gcc for i686-pc-linux-gnu X  
{alpha-linux-gnu,arc-elf,arm-eabi,avr-elf,bfin-elf,cris-elf,crx-elf,fr30-elf,frv-elf,h8300-elf,ia64-elf,iq2000-elf,lm32-elf,m32c-elf,m32r-elf,m68hc11-elf,m68k-elf,mcore-elf,mep-elf,mips-elf,mmix-knuth-mmixware,mn10300-elf,moxie-elf,hppa-linux-gnu,,pdp11-elf,picochip-elf,ppc-elf,rx-elf,s390-linux-gnu,score-elf,sh-elf,sparc-elf,spu-elf,xstormy16-elf,v850-elf,vax-linux-gnu,xtensa-elf}

with the configure option  --enable-werror-always and using
gcc version 4.6.0 20100630 (experimental) (GCC) .

We still have the same list of targets that pass:
alpha-linux-gnu
hppa-linux-gnu
ia64-elf
m68k-elf
mips-elf
ppc-elf
s390-linux-gnu
sparc-elf

, however, the nine targets previously affected by PR44752 now succeed
in building insn-automata.o, and only fail later for assorted other,
unrelated reasons.
2010-07-12  Joern Rennecke  <joern.rennecke@embecosm.com>

	PR rtl-optimization/44752
	* genautomata.c (main): Don't emit an empty file even if there
	is no automaton.

Comments

Richard Henderson July 12, 2010, 3:47 p.m. UTC | #1
> 	PR rtl-optimization/44752
> 	* genautomata.c (main): Don't emit an empty file even if there
> 	is no automaton.

Ok, but ...

> +  else
> +    puts ("/* Generated automatically by the program `genautomata'\n"
> +	  "   from the machine description file `md'.  */\n\n"
> +	  "/* There is no automaton, but ISO C forbids empty\n"
> +	  "   translation units, so include a header file with some\n"
> +	  "   declarations, and the its pre-requisite header file.  */\n"
> +	  "#include \"config.h\"\n"
> +	  "#include \"system.h\"\n");

... I'd prefer { } around this large multi-line statement.


r~
diff mbox

Patch

Index: genautomata.c
===================================================================
--- genautomata.c	(revision 162035)
+++ genautomata.c	(working copy)
@@ -9568,6 +9568,14 @@  main (int argc, char **argv)
 	  write_automata ();
 	}
     }
+  else
+    puts ("/* Generated automatically by the program `genautomata'\n"
+	  "   from the machine description file `md'.  */\n\n"
+	  "/* There is no automaton, but ISO C forbids empty\n"
+	  "   translation units, so include a header file with some\n"
+	  "   declarations, and the its pre-requisite header file.  */\n"
+	  "#include \"config.h\"\n"
+	  "#include \"system.h\"\n");
 
   fflush (stdout);
   return (ferror (stdout) != 0 || have_error