From 39d744bdccbb16bcd4681fbb850dafc9c63c4e25 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 3 Aug 2020 10:57:09 +0930 Subject: [PATCH] Tidy objdump_symstuff and objdump_dynsymstuff * testsuite/ld-elfvers/vers.exp (objdump_symstuff): Remove unused variable. Init list_a and list_b to empty. (objdump_dynsymstuff): Likewise, and remove undefined list_a handling. * testsuite/ld-elfweak/elfweak.exp (objdump_symstuff): Similarly. (objdump_dynsymstuff): Similarly. --- ld/ChangeLog | 9 +++++++++ ld/testsuite/ld-elfvers/vers.exp | 30 ++++++----------------------- ld/testsuite/ld-elfweak/elfweak.exp | 21 ++++++-------------- 3 files changed, 21 insertions(+), 39 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index f5a42f1ad0e..edde902940c 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2020-08-03 Alan Modra + + * testsuite/ld-elfvers/vers.exp (objdump_symstuff): Remove unused + variable. Init list_a and list_b to empty. + (objdump_dynsymstuff): Likewise, and remove undefined list_a + handling. + * testsuite/ld-elfweak/elfweak.exp (objdump_symstuff): Similarly. + (objdump_dynsymstuff): Similarly. + 2020-07-31 H.J. Lu * testsuite/ld-elf/indirect.exp: Append -fno-lto to CC. diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index 299cdaaae2d..0216b13b6ec 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -261,7 +261,8 @@ proc objdump_symstuff { objdump object expectfile } { verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 set eof -1 - set differences 0 + set list_a {} + set list_b {} while { [gets $file_a line] != $eof } { if [regexp "^#.*$" $line] then { @@ -286,7 +287,6 @@ proc objdump_symstuff { objdump object expectfile } { set line_a [lindex $list_a $i] set line_b [lindex $list_b $i] - verbose "\t$expectfile: $i: $line_a" 3 verbose "\t/tmp/objdump.out: $i: $line_b" 3 if [regexp $line_a $line_b] then { @@ -303,17 +303,12 @@ proc objdump_symstuff { objdump object expectfile } { verbose -log "Line count" return 0 } + return 1 - if $differences<1 then { - return 1 - } - - return 0 } else { verbose -log "$exec_output" return 0 } - } # @@ -357,7 +352,8 @@ proc objdump_dynsymstuff { objdump object expectfile } { verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 set eof -1 - set differences 0 + set list_a {} + set list_b {} while { [gets $file_a line] != $eof } { if [regexp "^#.*$" $line] then { @@ -378,15 +374,6 @@ proc objdump_dynsymstuff { objdump object expectfile } { } close $file_b - # Support empty files. - if { ![info exists list_a] } then { - if { ![info exists list_b] } then { - return 1 - } - verbose -log "\t$tmpdir/objdump.out: $list_b" - return 0 - } - for { set i 0 } { $i < [llength $list_b] } { incr i } { set line_b [lindex $list_b $i] @@ -423,17 +410,12 @@ proc objdump_dynsymstuff { objdump object expectfile } { verbose -log "Line count" return 0 } + return 1 - if $differences<1 then { - return 1 - } - - return 0 } else { verbose -log "$exec_output" return 0 } - } # diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index 85da211e803..3481878014d 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -103,7 +103,8 @@ proc objdump_symstuff { objdump object expectfile } { verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 set eof -1 - set differences 0 + set list_a {} + set list_b {} while { [gets $file_a line] != $eof } { if [regexp "^#.*$" $line] then { @@ -128,7 +129,6 @@ proc objdump_symstuff { objdump object expectfile } { set line_a [lindex $list_a $i] set line_b [lindex $list_b $i] - verbose "\t$expectfile: $i: $line_a" 3 verbose "\t/tmp/objdump.out: $i: $line_b" 3 if [regexp $line_a $line_b] then { @@ -145,17 +145,12 @@ proc objdump_symstuff { objdump object expectfile } { verbose -log "Line count" return 0 } + return 1 - if $differences<1 then { - return 1 - } - - return 0 } else { verbose -log "$exec_output" return 0 } - } # @@ -199,7 +194,8 @@ proc objdump_dynsymstuff { objdump object expectfile } { verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2 set eof -1 - set differences 0 + set list_a {} + set list_b {} while { [gets $file_a line] != $eof } { if [regexp "^#.*$" $line] then { @@ -256,17 +252,12 @@ proc objdump_dynsymstuff { objdump object expectfile } { verbose -log "Line count" return 0 } + return 1 - if $differences<1 then { - return 1 - } - - return 0 } else { verbose -log "$exec_output" return 0 } - } proc build_lib {test libname objs dynsymexp} { -- 2.30.2