Replace deprecated tcl case statements with switch statements

binutils/
	* testsuite/lib/binutils-common.exp (big_or_little_endian): Replace
	case statement with switch statement.
gas/
	* testsuite/gas/all/gas.exp: Replace case statements with switch
	statements.
	* testsuite/gas/elf/elf.exp: Likewise.
	* testsuite/gas/macros/macros.exp: Likewise.
	* testsuite/lib/gas-defs.exp: Likewise.
ld/
	* testsuite/ld-elfvers/vers.exp: Replace case statements with
	switch statements.
	* testsuite/ld-ifunc/ifunc.exp: Likewise.
	* testsuite/ld-unique/unique.exp: Likewise.
This commit is contained in:
Alan Modra 2020-01-27 10:51:52 +10:30
parent 7568c93bf9
commit e3696f67ab
11 changed files with 148 additions and 114 deletions

View file

@ -1,3 +1,8 @@
2020-01-27 Alan Modra <amodra@gmail.com>
* testsuite/lib/binutils-common.exp (big_or_little_endian): Replace
case statement with switch statement.
2020-01-24 Nick Clifton <nickc@redhat.com> 2020-01-24 Nick Clifton <nickc@redhat.com>
* readelf.c (get_build_id): Fix warning messages about corrupt * readelf.c (get_build_id): Fix warning messages about corrupt

View file

@ -1399,12 +1399,24 @@ proc big_or_little_endian {} {
set tmp_flags " [board_info [target_info name] multilib_flags]" set tmp_flags " [board_info [target_info name] multilib_flags]"
foreach x $tmp_flags { foreach x $tmp_flags {
case $x in { switch -glob $x {
{*big*endian eb EB -eb -EB -mb -meb} { *big*endian -
eb -
EB -
-eb -
-EB -
-mb -
-meb {
set flags " -EB" set flags " -EB"
return $flags return $flags
} }
{*little*endian el EL -el -EL -ml -mel} { *little*endian -
el -
EL -
-el -
-EL -
-ml -
-mel {
set flags " -EL" set flags " -EL"
return $flags return $flags
} }

View file

@ -1,3 +1,11 @@
2020-01-27 Alan Modra <amodra@gmail.com>
* testsuite/gas/all/gas.exp: Replace case statements with switch
statements.
* testsuite/gas/elf/elf.exp: Likewise.
* testsuite/gas/macros/macros.exp: Likewise.
* testsuite/lib/gas-defs.exp: Likewise.
2020-01-27 Tamar Christina <tamar.christina@arm.com> 2020-01-27 Tamar Christina <tamar.christina@arm.com>
PR 25403 PR 25403

View file

@ -80,9 +80,9 @@ if { ![ishost "*-*-mingw*"] } then {
} }
# .equ works differently on some targets. # .equ works differently on some targets.
case $target_triplet in { switch -glob $target_triplet {
{ hppa*-*-* } { } hppa*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
default { default {
gas_test "equ-ok.s" "" "" ".equ for symbol already set" gas_test "equ-ok.s" "" "" ".equ for symbol already set"
gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv" gas_test_error "equ-bad.s" "" ".equ for symbol already set through .eqv"
@ -106,19 +106,19 @@ run_dump_test forward
# mmix doesn't like .L1: # mmix doesn't like .L1:
# ti addresses aren't octets. # ti addresses aren't octets.
if { ![is_aout_format] } { if { ![is_aout_format] } {
case $target_triplet in { switch -glob $target_triplet {
{ hppa*64*-*-* } { hppa*64*-*-* {
run_dump_test fwdexp run_dump_test fwdexp
} }
{ alpha-*-*linux*ecoff } { } alpha-*-*linux*ecoff { }
{ alpha-*-osf* } { } alpha-*-osf* { }
{ hppa*-*-hpux* } { } hppa*-*-hpux* { }
{ mep-*-* } { } mep-*-* { }
{ mmix-*-* } { } mmix-*-* { }
{ nds32*-*-* } { } nds32*-*-* { }
{ tic30*-*-* } { } tic30*-*-* { }
{ tic4x*-*-* } { } tic4x*-*-* { }
{ tic54x*-*-* } { } tic54x*-*-* { }
default { default {
run_dump_test fwdexp run_dump_test fwdexp
} }
@ -129,23 +129,23 @@ if { ![is_aout_format] } {
# most of the tests won't work on targets that set linkrelax. # most of the tests won't work on targets that set linkrelax.
# 4 octet bytes confuse address matching on ti targets. # 4 octet bytes confuse address matching on ti targets.
# pdp11 gets unexpected reloc types. # pdp11 gets unexpected reloc types.
case $target_triplet in { switch -glob $target_triplet {
{ alpha*-*-* } { } alpha*-*-* { }
{ am3*-*-* } { } am3*-*-* { }
{ cr16*-*-* } { } cr16*-*-* { }
{ crx*-*-* } { } crx*-*-* { }
{ h8300-*-* } { } h8300-*-* { }
{ mips*-*-* } { } mips*-*-* { }
{ mn10200-*-* } { } mn10200-*-* { }
{ mn10300-*-* } { } mn10300-*-* { }
{ msp430*-*-* } { } msp430*-*-* { }
{ nds32*-*-* } { } nds32*-*-* { }
{ pdp11-*-* } { } pdp11-*-* { }
{ tic30*-*-* } { } tic30*-*-* { }
{ tic4x*-*-* } { } tic4x*-*-* { }
{ tic54x*-*-* } { } tic54x*-*-* { }
{ xtensa*-*-* } { } xtensa*-*-* { }
{ z80-*-* } { } z80-*-* { }
default { default {
run_dump_test redef run_dump_test redef
# These targets fail redef2 because they disallow redefined # These targets fail redef2 because they disallow redefined
@ -269,10 +269,10 @@ if { ![istarget *c30*-*-*]
# ".struct" and ".align" have different meanings on c54x # ".struct" and ".align" have different meanings on c54x
# These directives are done in the c54x-specific tests instead # These directives are done in the c54x-specific tests instead
case $target_triplet in { switch -glob $target_triplet {
{ hppa*-*-* } { } hppa*-*-* { }
{ *c4x*-*-* } { } *c4x*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
default { default {
run_dump_test struct run_dump_test struct
run_dump_test align run_dump_test align
@ -281,14 +281,14 @@ case $target_triplet in {
} }
# '<' and '>' appear to have special meanings on the excluded targets # '<' and '>' appear to have special meanings on the excluded targets
case $target_triplet in { switch -glob $target_triplet {
{ frv-*-* } { } frv-*-* { }
{ hppa*-*-* } { } hppa*-*-* { }
{ m32r-*-* } { } m32r-*-* { }
{ mmix-*-* } { } mmix-*-* { }
{ *c4x*-*-* } { } *c4x*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
{ bfin-*-* } { } bfin-*-* { }
default { default {
run_dump_test altmacro run_dump_test altmacro
# The second test is valid only when '!' is not a comment # The second test is valid only when '!' is not a comment
@ -342,14 +342,14 @@ proc test_cond {} {
# not limited to the fact that it depends on specific section # not limited to the fact that it depends on specific section
# names appearing in the output file. # names appearing in the output file.
# Again, p2align doesn't work on c54x and related targets. # Again, p2align doesn't work on c54x and related targets.
case $target_triplet in { switch -glob $target_triplet {
{ alpha-*-linux*ecoff} { } alpha-*-linux*ecoff { }
{ alpha-*-osf*} { } alpha-*-osf* { }
{ hppa*-*-* } { } hppa*-*-* { }
{ *c4x*-*-* } { } *c4x*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
{ rl78-*-* } { } rl78-*-* { }
{ rx-*-* } { } rx-*-* { }
default { default {
test_cond test_cond
remote_download host "$srcdir/$subdir/incbin.dat" remote_download host "$srcdir/$subdir/incbin.dat"
@ -394,11 +394,11 @@ run_dump_test quad
run_dump_test octa run_dump_test octa
# .set works differently on some targets. # .set works differently on some targets.
case $target_triplet in { switch -glob $target_triplet {
{ alpha*-*-* } { } alpha*-*-* { }
{ mips*-*-* } { } mips*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
{ z80-*-* } { } z80-*-* { }
default { default {
run_dump_test weakref1 run_dump_test weakref1
run_dump_test weakref1g run_dump_test weakref1g
@ -426,17 +426,17 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn
dg-finish dg-finish
# Set $nop_type appropriately to indicate the NOP instruction mnemonic. # Set $nop_type appropriately to indicate the NOP instruction mnemonic.
case $target_triplet in { switch -glob $target_triplet {
{ "bpf-*-*" } { bpf-*-* {
set nop_type 6 set nop_type 6
} }
{ "mmix-*-*" } { mmix-*-* {
set nop_type 5 set nop_type 5
} }
{ "or1k*-*-*" } { or1k*-*-* {
set nop_type 2 set nop_type 2
} }
{ "ia64-*-*" } { ia64-*-* {
set nop_type 1 set nop_type 1
} }
default { default {

View file

@ -112,14 +112,15 @@ if { [is_elf_format] } then {
&& ![istarget "am3*-*-*"]} then { && ![istarget "am3*-*-*"]} then {
run_dump_test "ehopt0" run_dump_test "ehopt0"
} }
case $target_triplet in { switch -glob $target_triplet {
{ m68k-*-* m68[03]??-*-* } { m68k-*-* -
m68[03]??-*-* {
run_dump_test "file" { { as "--defsym m68k=1" } } run_dump_test "file" { { as "--defsym m68k=1" } }
} }
{ mmix-*-* } { mmix-*-* {
run_dump_test "file" { { as "--defsym mmix=1" } } run_dump_test "file" { { as "--defsym mmix=1" } }
} }
{ xtensa*-*-* } { xtensa*-*-* {
run_dump_test "file" { { as "--rename-section file.s=file.c" } } run_dump_test "file" { { as "--rename-section file.s=file.c" } }
} }
default { default {
@ -135,37 +136,37 @@ if { [is_elf_format] } then {
run_dump_test "group1b" run_dump_test "group1b"
run_dump_test "group2" run_dump_test "group2"
run_dump_test "group3" run_dump_test "group3"
case $target_triplet in { switch -glob $target_triplet {
{ hppa64*-*-hpux* } { } hppa64*-*-hpux* { }
{ riscv*-*-* } { } riscv*-*-* { }
default { default {
run_dump_test "groupautoa" run_dump_test "groupautoa"
} }
} }
case $target_triplet in { switch -glob $target_triplet {
{ hppa64*-*-hpux* } { } hppa64*-*-hpux* { }
{ riscv*-*-* } { } riscv*-*-* { }
{ xtensa*-*-* } { } xtensa*-*-* { }
default { default {
run_dump_test "groupautob" run_dump_test "groupautob"
} }
} }
case $target_triplet in { switch -glob $target_triplet {
{ alpha*-*-* } { } alpha*-*-* { }
{ am3*-*-* } { } am3*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
{ cr16*-*-* } { } cr16*-*-* { }
{ crx*-*-* } { } crx*-*-* { }
{ h8300-*-* } { } h8300-*-* { }
{ hppa*-*-* } { } hppa*-*-* { }
{ iq2000*-*-* } { } iq2000*-*-* { }
{ mips*-*-* } { } mips*-*-* { }
{ mn10200-*-* } { } mn10200-*-* { }
{ mn10300-*-* } { } mn10300-*-* { }
{ msp43*-*-* } { } msp43*-*-* { }
{ rl78-*-* } { } rl78-*-* { }
{ riscv*-*-* } { } riscv*-*-* { }
{ rx-*-* } { } rx-*-* { }
default { default {
# The next test can fail if the target does not convert fixups # The next test can fail if the target does not convert fixups
# against ordinary symbols into relocations against section symbols. # against ordinary symbols into relocations against section symbols.
@ -183,11 +184,12 @@ if { [is_elf_format] } then {
# new sections created without atrributes. # new sections created without atrributes.
if {! [istarget "h8300-*-*"]} then { if {! [istarget "h8300-*-*"]} then {
set as_flags "-al --generate-missing-build-notes=no" set as_flags "-al --generate-missing-build-notes=no"
case $target_triplet in { switch -glob $target_triplet {
{ i*86-*-* x86_64-*-* } { i*86-*-* -
x86_64-*-* {
set as_flags "$as_flags -mx86-used-note=no" set as_flags "$as_flags -mx86-used-note=no"
} }
{ riscv*-*-* } { riscv*-*-* {
set as_flags "$as_flags -march-attr" set as_flags "$as_flags -march-attr"
} }
} }

View file

@ -42,10 +42,10 @@ gas_test_error "err.s" "" "macro infinite recursion"
setup_xfail "tic4x*-*" setup_xfail "tic4x*-*"
gas_test "and.s" "" "" "logical and in macro definition" gas_test "and.s" "" "" "logical and in macro definition"
case $target_triplet in { switch -glob $target_triplet {
{ hppa*-*-* } { if [istarget *-*-linux*] { run_dump_test semi } } hppa*-*-* { if [istarget *-*-linux*] { run_dump_test semi } }
{ *c4x*-*-* } { } *c4x*-*-* { }
{ *c54x*-*-* } { } *c54x*-*-* { }
default { default {
run_dump_test semi run_dump_test semi
} }
@ -74,14 +74,14 @@ run_dump_test app4
run_list_test badarg "" run_list_test badarg ""
case $target_triplet in { switch -glob $target_triplet {
{ *c54x*-*-* } { } *c54x*-*-* { }
{ *c4x*-*-* } { } *c4x*-*-* { }
{ mmix-* } { } mmix-* { }
{ ns32k-*-* } { } ns32k-*-* { }
{ rl78-*-* } { } rl78-*-* { }
{ rx-*-* } { } rx-*-* { }
{ vax-*-* } { } vax-*-* { }
default { run_list_test dot "-alm" } default { run_list_test dot "-alm" }
} }
run_list_test end "" run_list_test end ""

View file

@ -267,7 +267,7 @@ proc gas_init { args } {
global target_os global target_os
global stdoptlist global stdoptlist
case "$target_cpu" in { switch -glob "$target_cpu" {
"m68???" { set target_cpu_family m68k } "m68???" { set target_cpu_family m68k }
"i[3-7]86" { set target_cpu_family i386 } "i[3-7]86" { set target_cpu_family i386 }
default { set target_cpu_family $target_cpu } default { set target_cpu_family $target_cpu }

View file

@ -1,3 +1,10 @@
2020-01-27 Alan Modra <amodra@gmail.com>
* testsuite/ld-elfvers/vers.exp: Replace case statements with
switch statements.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-unique/unique.exp: Likewise.
2020-01-27 H.J. Lu <hongjiu.lu@intel.com> 2020-01-27 H.J. Lu <hongjiu.lu@intel.com>
Alan Modra <amodra@gmail.com> Alan Modra <amodra@gmail.com>

View file

@ -92,9 +92,9 @@ if { [istarget mips*-*-*] && ! [at_least_gcc_version 4 3] } then {
} }
} }
case $target_triplet in { switch -glob $target_triplet {
{ ia64-*-* } { set as_options "-x" } ia64-*-* { set as_options "-x" }
{ sparc-*-* } { set as_options "-Av9a" } sparc-*-* { set as_options "-Av9a" }
default { set as_options "" } default { set as_options "" }
} }

View file

@ -268,8 +268,8 @@ if { $fails == 0 } {
# ifunc should have an OSABI field of GNU. The linked non-ifunc using # ifunc should have an OSABI field of GNU. The linked non-ifunc using
# executable should have an OSABI field of NONE (aka System V). # executable should have an OSABI field of NONE (aka System V).
case $target_triplet in { switch -glob $target_triplet {
{ hppa*-*-linux* } { set expected_none {UNIX - GNU} } hppa*-*-linux* { set expected_none {UNIX - GNU} }
default { set expected_none {UNIX - System V} } default { set expected_none {UNIX - System V} }
} }

View file

@ -163,8 +163,8 @@ if { $fails == 0 } {
} }
# Check the empty object file. # Check the empty object file.
case $target_triplet in { switch -glob $target_triplet {
{ hppa*-*-linux* } { set expected_none {UNIX - GNU} } hppa*-*-linux* { set expected_none {UNIX - GNU} }
default { set expected_none {UNIX - System V} } default { set expected_none {UNIX - System V} }
} }
if {! [check_osabi tmpdir/unique_empty.o $expected_none]} { if {! [check_osabi tmpdir/unique_empty.o $expected_none]} {