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]
Other format: [Raw text]

[Committed] S/390: Fix enum warning for the cpu attribute


Hi,

the attached patch fixes a problem which has been revealed by Ians
-Wenum-compare for C patch.  When mapping an attribute to an enum
variable the code generated by genattrtab compares the external enum
variable with a value from the enum generated for the attribute - what
now leads to a warning.

One way to fix this would be to have genattrtab to emit a type cast
but I have choosen to do what rs6000 does and use a macro definition
to sneak the cast into inst-attrtab.c.

Committed to mainline.  Fixes bootstrap on s390 and s390x.

Bye,

-Andreas-


2009-04-17  Andreas Krebbel  <krebbel1@de.ibm.com>

	* config/s390/s390.h (s390_tune_attr): New macro definition.
	* config/s390/s390.md (cpu attribute): Map to s390_tune_attr.


Index: gcc/config/s390/s390.h
===================================================================
--- gcc/config/s390/s390.h.orig	2009-04-17 15:14:48.000000000 +0200
+++ gcc/config/s390/s390.h	2009-04-17 15:16:32.000000000 +0200
@@ -60,6 +60,10 @@ enum processor_flags
 extern enum processor_type s390_tune;
 extern enum processor_flags s390_tune_flags;
 
+/* This is necessary to avoid a warning about comparing different enum
+   types.  */
+#define s390_tune_attr ((enum attr_cpu)s390_tune)
+
 extern enum processor_type s390_arch;
 extern enum processor_flags s390_arch_flags;
 
Index: gcc/config/s390/s390.md
===================================================================
--- gcc/config/s390/s390.md.orig	2009-04-17 15:14:48.000000000 +0200
+++ gcc/config/s390/s390.md	2009-04-17 15:16:32.000000000 +0200
@@ -262,7 +262,7 @@
 ;; CPUs could in theory be modeled.
 
 (define_attr "cpu" "g5,g6,z900,z990,z9_109,z10"
-  (const (symbol_ref "s390_tune")))
+  (const (symbol_ref "s390_tune_attr")))
 
 (define_attr "cpu_facility" "standard,ieee,zarch,longdisp,extimm,dfp,z10"
   (const_string "standard"))


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