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]

[patch] simplify is-effective-target in target-supports.exp


The number of effective-target keywords is growing rapidly, so this
patch simplifies the proc that invokes the right check for a target when
procs for new keywords follow the same naming convention.  This change
is part of http://gcc.gnu.org/ml/gcc-patches/2004-11/msg01507.html.

Tested on powerpc64-linux with -m32 and -m64.  I'm checking it in.

2004-11-30  Janis Johnson  <janis187@us.ibm.com>

	* lib/target-supports.exp (is-effective-target): Simplify.

--- lib/target-supports.exp.orig	2004-11-30 12:51:13.000000000 -0800
+++ lib/target-supports.exp	2004-11-30 12:52:19.000000000 -0800
@@ -525,17 +525,15 @@ proc check_effective_target_vect_double 
 
 proc is-effective-target { arg } {
     set selected 0
-    switch $arg {
-	"ilp32"  { set selected [check_effective_target_ilp32] }
-	"lp64"   { set selected [check_effective_target_lp64] }
-	"vmx_hw" { set selected [check_vmx_hw_available] }
-	"named_sections" { set selected [check_named_sections_available] }
-	"gc_sections" { set selected [check_gc_sections_available] }
-	"vect_int" { set selected [check_effective_target_vect_int] }
-	"vect_long" { set selected [check_effective_target_vect_long] }
-	"vect_float" { set selected [check_effective_target_vect_float] }
-	"vect_double" { set selected [check_effective_target_vect_double] }
-	default  { error "unknown effective target selector `$arg'" }
+    if { [info procs check_effective_target_${arg}] != [list] } {
+	set selected [check_effective_target_${arg}]
+    } else {
+	switch $arg {
+	  "vmx_hw"         { set selected [check_vmx_hw_available] }
+	  "named_sections" { set selected [check_named_sections_available] }
+	  "gc_sections"    { set selected [check_gc_sections_available] }
+	  default          { error "unknown effective target keyword `$arg'" }
+	}
     }
     verbose "is-effective-target: $arg $selected" 2
     return $selected


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