This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][1/3] Unbreak m68k bootstrap
- From: Maxim Kuvyrkov <maxim at codesourcery dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Roman Zippel <zippel at linux-m68k dot org>
- Date: Sun, 14 Oct 2007 14:03:59 +0400
- Subject: [PATCH][1/3] Unbreak m68k bootstrap
- References: <4711E7FF.7010002@codesourcery.com>
Hi,
This patch provides means to fix bootstrap failure on m68k. Bootstrap
fails due to warnings 'ansi C forbids forward declaration of enum types'
on enum attr_* used in m68k.h. In other words, this says that enums
generated for instruction attributes can't be used in <arch>.h files.
Though there are no design reasons for this resctriction, all ports
workaround it by declaring mirroring enum with the same values:
E.g.
(define_attr "cpu" "p1,p2,unknown" (const (symbol_ref "tune_cpu")))
expands into
enum attr_cpu { CPU_P1, CPU_P2, CPU_UNKNOWN };
then in <arch>.h:
enum processor { PROCESSOR_P1, PROCESSOR_P2, PROCESSOR_MAX };
And now CPU_Pn and PROCESSOR_Pn are interchangeable.
When using the above scheme there is a risk of going out of sync.
This patch rearranges headers of insn-attrtab.c to fix the issue. With
this patch applied it is ok to use autogenerated enums in <arch>-protos.h .
The patch was bootstrapped on {x86_64, m68k, ia64, ppc64}-unknown-linux-gnu.
OK for trunk?
:ADDPATCH middle-end:
Thanks,
Maxim
2007-10-12 Maxim Kuvyrkov <maxim@codesourcery.com>
* genattrtab.c (main): Rearrange output of insn-attrtab.c headers.
Index: genattrtab.c
===================================================================
--- genattrtab.c (revision 184625)
+++ genattrtab.c (working copy)
@@ -4530,13 +4530,13 @@ from the machine description file `md'.
printf ("#include \"coretypes.h\"\n");
printf ("#include \"tm.h\"\n");
printf ("#include \"rtl.h\"\n");
+ printf ("#include \"insn-attr.h\"\n");
printf ("#include \"tm_p.h\"\n");
printf ("#include \"insn-config.h\"\n");
printf ("#include \"recog.h\"\n");
printf ("#include \"regs.h\"\n");
printf ("#include \"real.h\"\n");
printf ("#include \"output.h\"\n");
- printf ("#include \"insn-attr.h\"\n");
printf ("#include \"toplev.h\"\n");
printf ("#include \"flags.h\"\n");
printf ("#include \"function.h\"\n");