Patchwork [testsuite] : Use istarget everywhere

login
register
mail settings
Submitter Uros Bizjak
Date July 13, 2011, 4:27 p.m.
Message ID <CAFULd4aOinNapR0QX-uK10Y84wmaQo34zZE_+r7bGQpAk_tO4g@mail.gmail.com>
Download mbox | patch
Permalink /patch/104560/
State New
Headers show

Comments

Uros Bizjak - July 13, 2011, 4:27 p.m.
Hello!

Attached patch converts several places where string match or regexp on
$target_triplet is used with istarget.  The patch also removes quotes
around target string.

2011-07-13  Uros Bizjak  <ubizjak@gmail.com>

	* lib/g++.exp (g++_init):  Use istarget.  Remove target_triplet global.
	* lib/obj-c++.exp (obj-c++_init): Ditto.
	* lib/file-format.exp (gcc_target_object_format): Ditto.
	* lib/target-supports-dg.exp (dg-require-dll): Ditto.
	* lib/target-supports-dg-exp (check_weak_available): Ditto.
	(check_visibility_available): Ditto.
	(check_effective_target_tls_native): Ditto.
	(check_effective_target_tls_emulated): Ditto.
	(check_effective_target_function_sections): Ditto.

Tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline SVN.

Uros.

Patch

Index: lib/g++.exp
===================================================================
--- lib/g++.exp	(revision 176236)
+++ lib/g++.exp	(working copy)
@@ -188,7 +188,6 @@ 
     global TOOL_EXECUTABLE TOOL_OPTIONS
     global GXX_UNDER_TEST
     global TESTING_IN_BUILD_TREE
-    global target_triplet
     global gcc_warning_prefix
     global gcc_error_prefix
 
@@ -263,7 +262,7 @@ 
     set gcc_warning_prefix "warning:"
     set gcc_error_prefix "error:"
 
-    if { [string match "*-*-darwin*" $target_triplet] } {
+    if { [istarget *-*-darwin*] } {
 	lappend ALWAYS_CXXFLAGS "ldflags=-multiply_defined suppress"
        }
 
Index: lib/obj-c++.exp
===================================================================
--- lib/obj-c++.exp	(revision 176236)
+++ lib/obj-c++.exp	(working copy)
@@ -210,7 +210,6 @@ 
     global TOOL_EXECUTABLE TOOL_OPTIONS
     global OBJCXX_UNDER_TEST
     global TESTING_IN_BUILD_TREE
-    global target_triplet
     global gcc_warning_prefix
     global gcc_error_prefix
 
@@ -270,7 +269,7 @@ 
     set gcc_warning_prefix "warning:"
     set gcc_error_prefix "error:"
 
-    if { [string match "*-*-darwin*" $target_triplet] } {
+    if { [istarget *-*-darwin*] } {
 	lappend ALWAYS_OBJCXXFLAGS "ldflags=-multiply_defined suppress"
     }
 
@@ -299,7 +298,7 @@ 
     # we need to add the include path for the gnu runtime if that is in
     # use.
     # First, set the default...
-    if { [istarget "*-*-darwin*"] } {
+    if { [istarget *-*-darwin*] } {
 	set nextruntime 1
     } else {
 	set nextruntime 0
Index: lib/scanasm.exp
===================================================================
--- lib/scanasm.exp	(revision 176236)
+++ lib/scanasm.exp	(working copy)
@@ -461,10 +461,10 @@ 
 	}
     }
 
-    if { [istarget "hppa*-*-*"] } {
+    if { [istarget hppa*-*-*] } {
 	set pattern [format {\t;[^:]+:%d\n(\t[^\t]+\n)+%s:\n\t.PROC} \
                      $line $symbol]
-    } elseif { [istarget "mips-sgi-irix*"] } {
+    } elseif { [istarget mips-sgi-irix*] } {
 	set pattern [format {\t\.loc [0-9]+ %d 0( [^\n]*)?\n\t\.set\t(no)?mips16\n\t\.ent\t%s\n\t\.type\t%s, @function\n%s:\n} \
 		     $line $symbol $symbol $symbol]
     } else {
Index: lib/file-format.exp
===================================================================
--- lib/file-format.exp	(revision 176236)
+++ lib/file-format.exp	(working copy)
@@ -24,17 +24,16 @@ 
 
 proc gcc_target_object_format { } { 
     global gcc_target_object_format_saved
-    global target_triplet
     global tool
 
     if [info exists gcc_target_object_format_saved] {
         verbose "gcc_target_object_format returning saved $gcc_target_object_format_saved" 2
-    } elseif { [string match "*-*-darwin*" $target_triplet] } {
+    } elseif { [istarget *-*-darwin*] } {
 	# Darwin doesn't necessarily have objdump, so hand-code it.
 	set gcc_target_object_format_saved mach-o
-    } elseif { [string match "hppa*-*-hpux*" $target_triplet] } {
+    } elseif { [istarget hppa*-*-hpux*] } {
 	# HP-UX doesn't necessarily have objdump, so hand-code it.
-	if { [string match "hppa*64*-*-hpux*" $target_triplet] } {
+	if { [istarget hppa*64*-*-hpux*] } {
 	  set gcc_target_object_format_saved elf
 	} else {
 	  set gcc_target_object_format_saved som
Index: lib/target-libpath.exp
===================================================================
--- lib/target-libpath.exp	(revision 176236)
+++ lib/target-libpath.exp	(working copy)
@@ -272,11 +272,11 @@ 
 proc get_shlib_extension { } {
     global shlib_ext
 
-    if { [ istarget *-*-darwin* ] } {
+    if { [istarget *-*-darwin*] } {
 	set shlib_ext "dylib"
-    } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } {
+    } elseif { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
 	set shlib_ext "dll"
-    } elseif { [ istarget hppa*-*-hpux* ] } {
+    } elseif { [istarget hppa*-*-hpux*] } {
 	set shlib_ext "sl"
     } else {
 	set shlib_ext "so"
Index: lib/go-torture.exp
===================================================================
--- lib/go-torture.exp	(revision 176236)
+++ lib/go-torture.exp	(working copy)
@@ -356,14 +356,14 @@ 
 #
 proc add-ieee-options { } {
     # Ensure that excess precision does not cause problems.
-    if { [istarget "i?86-*-*"]
-	 || [istarget "m68k-*-*"] } then {
+    if { [istarget i?86-*-*]
+	 || [istarget m68k-*-*] } then {
       uplevel 1 lappend additional_flags "-ffloat-store"
     }
 
     # Enable full IEEE compliance mode.
-    if { [istarget "alpha*-*-*"]
-         || [istarget "sh*-*-*"] } then {
+    if { [istarget alpha*-*-*]
+         || [istarget sh*-*-*] } then {
       uplevel 1 lappend additional_flags "-mieee"
     }
 }
Index: lib/gcc-defs.exp
===================================================================
--- lib/gcc-defs.exp	(revision 176236)
+++ lib/gcc-defs.exp	(working copy)
@@ -157,8 +157,8 @@ 
     if [regexp "(^|\n)\[^\n\]*: region \[^\n\]* is full" $output] {
 	return "memory full"
     }
-    if {[istarget spu-*-*] && \
-            [string match "*exceeds local store*" $output]} {
+    if { [istarget spu-*-*] && \
+	     [string match "*exceeds local store*" $output] } {
 	return "memory full"
     }
     return ""
Index: lib/target-supports-dg.exp
===================================================================
--- lib/target-supports-dg.exp	(revision 176236)
+++ lib/target-supports-dg.exp	(working copy)
@@ -122,11 +122,10 @@ 
 # If this target does not support DLL attributes skip this test.
 
 proc dg-require-dll { args } {
-    global target_triplet
     # As a special case, the mcore-*-elf supports these attributes.
     # All Symbian OS targets also support these attributes.
-    if { [string match "mcore-*-elf" $target_triplet]
-         || [string match "*-*-symbianelf" $target_triplet]} {
+    if { [istarget mcore-*-elf]
+         || [istarget *-*-symbianelf] } {
 	return
     }
     # PE/COFF targets support dllimport/dllexport.
Index: lib/objc.exp
===================================================================
--- lib/objc.exp	(revision 176236)
+++ lib/objc.exp	(working copy)
@@ -150,7 +150,7 @@ 
     # we need to add the include path for the gnu runtime if that is in 
     # use.
     # First set the default...
-    if { [istarget "*-*-darwin*"] } {
+    if { [istarget *-*-darwin*] } {
 	set nextruntime 1
     } else {
 	set nextruntime 0
Index: lib/fortran-torture.exp
===================================================================
--- lib/fortran-torture.exp	(revision 176236)
+++ lib/fortran-torture.exp	(working copy)
@@ -37,33 +37,33 @@ 
 
     set vectorizer_options [list "-O2" "-ftree-vectorize"]
 
-    if { [istarget "powerpc*-*-*"]
+    if { [istarget powerpc*-*-*]
 	 && [is-effective-target powerpc_altivec_ok]
 	 && [check_vmx_hw_available] } {
 	lappend vectorizer_options "-maltivec"
 	set test_tree_vectorize 1
-    } elseif { [istarget  "spu-*-*"] } {
+    } elseif { [istarget spu-*-*] } {
 	set test_tree_vectorize 1
-    } elseif { ( [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] )
+    } elseif { ( [istarget i?86-*-*] || [istarget x86_64-*-*] )
 	       && [check_effective_target_sse2]
 	       && [check_sse2_hw_available]
 	       && [check_sse_os_support_available] } {
 	lappend vectorizer_options "-msse2"
 	set test_tree_vectorize 1
-    } elseif { [istarget "mips*-*-*"]
+    } elseif { [istarget mips*-*-*]
 	       && [check_effective_target_mpaired_single]
 	       && [check_effective_target_nomips16] } {
 	lappend vectorizer_options "-mpaired-single"
 	set test_tree_vectorize 1
-    } elseif { [istarget "sparc*-*-*"]
+    } elseif { [istarget sparc*-*-*]
 	       && [check_effective_target_ultrasparc_hw] } {
 	lappend vectorizer_options "-mcpu=ultrasparc" "-mvis"
 	set test_tree_vectorize 1
-    } elseif { [istarget "alpha*-*-*"]
+    } elseif { [istarget alpha*-*-*]
 	       && [check_alpha_max_hw_available] } {
 	lappend vectorizer_options "-mmax"
 	set test_tree_vectorize 1
-    } elseif [istarget "ia64-*-*"] {
+    } elseif [istarget ia64-*-*] {
 	set test_tree_vectorize 1
     } else {
 	set test_tree_vectorize 0
@@ -414,14 +414,14 @@ 
 #
 proc add-ieee-options { } {
     # Ensure that excess precision does not cause problems.
-    if { [istarget "i?86-*-*"]
-	 || [istarget "m68k-*-*"] } then {
+    if { [istarget i?86-*-*]
+	 || [istarget m68k-*-*] } then {
       uplevel 1 lappend additional_flags "-ffloat-store"
     }
 
     # Enable full IEEE compliance mode.
-    if { [istarget "alpha*-*-*"]
-         || [istarget "sh*-*-*"] } then {
+    if { [istarget alpha*-*-*]
+         || [istarget sh*-*-*] } then {
       uplevel 1 lappend additional_flags "-mieee"
     }
 }
Index: lib/objc-torture.exp
===================================================================
--- lib/objc-torture.exp	(revision 176236)
+++ lib/objc-torture.exp	(working copy)
@@ -30,7 +30,7 @@ 
     # installation can have the objc headers present in the same locations 
     # that Darwin uses.  If NeXT is ported to another target, then it should
     # be listed here.
-    if [istarget "*-*-darwin*" ] {
+    if [istarget *-*-darwin*] {
       lappend rtlist "-fnext-runtime" 
     }
     if [info exists OBJC_RUNTIME_OPTIONS] {
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp	(revision 176236)
+++ lib/target-supports.exp	(working copy)
@@ -219,7 +219,6 @@ 
 # this proc returns 1 if they're supported, 0 if they're not, or -1 if unsure
 
 proc check_weak_available { } {
-    global target_triplet
     global target_cpu
 
     # All mips targets should support it
@@ -230,25 +229,25 @@ 
 
     # All solaris2 targets should support it
 
-    if { [regexp ".*-solaris2.*" $target_triplet] } {
+    if { [istarget *-*-solaris2*] } {
         return 1
     }
 
     # DEC OSF/1/Digital UNIX/Tru64 UNIX supports it
 
-    if { [regexp "alpha.*osf.*" $target_triplet] } {
+    if { [istarget alpha*-dec-osf*] } {
 	return 1
     }
 
     # Windows targets Cygwin and MingW32 support it
 
-    if { [regexp ".*mingw32|.*cygwin" $target_triplet] } {
+    if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
 	return 1
     }
 
     # HP-UX 10.X doesn't support it
 
-    if { [istarget "hppa*-*-hpux10*"] } {
+    if { [istarget hppa*-*-hpux10*] } {
 	return 0
     }
 
@@ -276,7 +275,7 @@ 
 # cannot be overridden.
 
 proc check_weak_override_available { } {
-    if { [istarget "*-*-mingw*"] } {
+    if { [istarget *-*-mingw*] } {
 	return 0
     }
     return [check_weak_available]
@@ -291,9 +290,6 @@ 
 # The argument is the kind of visibility, default/protected/hidden/internal.
 
 proc check_visibility_available { what_kind } {
-    global tool
-    global target_triplet
-
     # On NetWare, support makes no sense.
     if { [istarget *-*-netware*] } {
         return 0
@@ -627,7 +623,7 @@ 
 proc add_options_for_tls { flags } {
     # Tru64 UNIX uses emutls, which relies on a couple of pthread functions
     # which only live in libpthread, so always pass -pthread for TLS.
-    if { [istarget *-*-osf*] } {
+    if { [istarget alpha*-dec-osf*] } {
 	return "$flags -pthread"
     }
     # On Solaris 8 and 9, __tls_get_addr/___tls_get_addr only lives in
@@ -660,8 +656,7 @@ 
 proc check_effective_target_tls_native {} {
     # VxWorks uses emulated TLS machinery, but with non-standard helper
     # functions, so we fail to automatically detect it.
-    global target_triplet
-    if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
+    if { [istarget *-*-vxworks*] } {
 	return 0
     }
     
@@ -677,8 +672,7 @@ 
 proc check_effective_target_tls_emulated {} {
     # VxWorks uses emulated TLS machinery, but with non-standard helper
     # functions, so we fail to automatically detect it.
-    global target_triplet
-    if { [regexp ".*-.*-vxworks.*" $target_triplet] } {
+    if { [istarget *-*-vxworks*] } {
 	return 1
     }
     
@@ -702,8 +696,7 @@ 
 
 proc check_effective_target_function_sections {} {
     # Darwin has its own scheme and silently accepts -ffunction-sections.
-    global target_triplet
-    if { [regexp ".*-.*-darwin.*" $target_triplet] } {
+    if { [istarget *-*-darwin*] } {
 	return 0
     }
     
@@ -1435,7 +1428,7 @@ 
 # Returns true iff "mkfifo" is available on the target system.
 
 proc check_mkfifo_available {} {
-    if {[istarget *-*-cygwin*]} {
+    if { [istarget *-*-cygwin*] } {
        # Cygwin has mkfifo, but support is incomplete.
        return 0
      }
@@ -1447,10 +1440,10 @@ 
 
 proc check_cxa_atexit_available { } {
     return [check_cached_effective_target cxa_atexit_available {
-	if { [istarget "hppa*-*-hpux10*"] } {
+	if { [istarget hppa*-*-hpux10*] } {
 	    # HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
 	    expr 0
-	} elseif { [istarget "*-*-vxworks"] } {
+	} elseif { [istarget *-*-vxworks] } {
 	    # vxworks doesn't have __cxa_atexit but subsequent test passes.
 	    expr 0
 	} else {
@@ -2282,7 +2275,7 @@ 
 # Return 1 if this is a PowerPC target that supports SPU.
 
 proc check_effective_target_powerpc_spu { } {
-    if [istarget powerpc*-*-linux*] {
+    if { [istarget powerpc*-*-linux*] } {
 	return [check_effective_target_powerpc_altivec_ok]
     } else {
 	return 0
@@ -3705,11 +3698,11 @@ 
 # full IEEE compliance mode.
 
 proc add_options_for_ieee { flags } {
-    if { [istarget "alpha*-*-*"]
-         || [istarget "sh*-*-*"] } {
+    if { [istarget alpha*-*-*]
+         || [istarget sh*-*-*] } {
        return "$flags -mieee"
     }
-    if { [istarget "rx-*-*"] } {
+    if { [istarget rx-*-*] } {
        return "$flags -mnofpu"
     }
     return $flags
@@ -3999,21 +3992,21 @@ 
     global DEFAULT_VECTCFLAGS
     global dg-do-what-default
 
-    if  [istarget "powerpc-*paired*"]  {
+    if  [istarget powerpc-*paired*]  {
         lappend DEFAULT_VECTCFLAGS "-mpaired"
         if [check_750cl_hw_available] {
             set dg-do-what-default run
         } else {
             set dg-do-what-default compile
         }
-    } elseif [istarget "powerpc*-*-*"] {
+    } elseif [istarget powerpc*-*-*] {
         # Skip targets not supporting -maltivec.
         if ![is-effective-target powerpc_altivec_ok] {
             return 0
         }
 
         lappend DEFAULT_VECTCFLAGS "-maltivec"
-        if [check_vsx_hw_available]  {
+        if [check_vsx_hw_available] {
             lappend DEFAULT_VECTCFLAGS "-mvsx" "-mno-allow-movmisalign"
         }
 
@@ -4026,16 +4019,16 @@ 
             }
             set dg-do-what-default compile
         }
-    } elseif { [istarget  "spu-*-*"] } {
+    } elseif { [istarget spu-*-*] } {
         set dg-do-what-default run
-    } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } {
+    } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
         lappend DEFAULT_VECTCFLAGS "-msse2"
         if { [check_effective_target_sse2_runtime] } {
             set dg-do-what-default run
         } else {
             set dg-do-what-default compile
         }
-    } elseif { [istarget "mips*-*-*"]
+    } elseif { [istarget mips*-*-*]
                && ([check_effective_target_mpaired_single]
                     || [check_effective_target_mips_loongson])
                && [check_effective_target_nomips16] } {
@@ -4043,14 +4036,14 @@ 
             lappend DEFAULT_VECTCFLAGS "-mpaired-single"
         }
         set dg-do-what-default run
-    } elseif [istarget "sparc*-*-*"] {
+    } elseif [istarget sparc*-*-*] {
         lappend DEFAULT_VECTCFLAGS "-mcpu=ultrasparc" "-mvis"
         if [check_effective_target_ultrasparc_hw] {
             set dg-do-what-default run
         } else {
             set dg-do-what-default compile
         }
-    } elseif [istarget "alpha*-*-*"] {
+    } elseif [istarget alpha*-*-*] {
         # Alpha's vectorization capabilities are extremely limited.
         # It's more effort than its worth disabling all of the tests
         # that it cannot pass.  But if you actually want to see what
@@ -4063,7 +4056,7 @@ 
         } else {
             set dg-do-what-default compile
         }
-    } elseif [istarget "ia64-*-*"] {
+    } elseif [istarget ia64-*-*] {
         set dg-do-what-default run
     } elseif [is-effective-target arm_neon_ok] {
         eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]