[v2,25/37] GDB: testsuite: linespec: Don't return value from top-level

Message ID 20260429230432.60487-26-thiago.bauermann@linaro.org
State New
Headers
Series GDB: testsuite: Fix top-level returns |

Commit Message

Thiago Jung Bauermann April 29, 2026, 11:04 p.m. UTC
  Most changes are the result of running:

$ sed -i 's/^    return -1/    return/' *.exp

inside gdb/testsuite/gdb.linespec.  The exceptions fall into one of
these criteria:

- misaligned line, which is then fixed by this patch;
- return at top level but inside a namespace block.

A couple of "return 0" statements were also fixed.
---
 gdb/testsuite/gdb.linespec/break-ask.exp                  | 2 +-
 gdb/testsuite/gdb.linespec/break-asm-file.exp             | 8 ++++----
 gdb/testsuite/gdb.linespec/cp-completion-aliases.exp      | 2 +-
 .../gdb.linespec/cp-replace-typedefs-ns-template.exp      | 2 +-
 gdb/testsuite/gdb.linespec/cpcompletion.exp               | 4 ++--
 gdb/testsuite/gdb.linespec/cpexplicit.exp                 | 4 ++--
 gdb/testsuite/gdb.linespec/cpls-abi-tag.exp               | 4 ++--
 gdb/testsuite/gdb.linespec/cpls-ops.exp                   | 4 ++--
 gdb/testsuite/gdb.linespec/errors.exp                     | 2 +-
 gdb/testsuite/gdb.linespec/explicit.exp                   | 4 ++--
 gdb/testsuite/gdb.linespec/keywords.exp                   | 4 ++--
 gdb/testsuite/gdb.linespec/linespec.exp                   | 2 +-
 gdb/testsuite/gdb.linespec/ls-dollar.exp                  | 2 +-
 gdb/testsuite/gdb.linespec/macro-relative.exp             | 2 +-
 gdb/testsuite/gdb.linespec/skip-two.exp                   | 6 +++---
 gdb/testsuite/gdb.linespec/thread.exp                     | 4 ++--
 16 files changed, 28 insertions(+), 28 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.linespec/break-ask.exp b/gdb/testsuite/gdb.linespec/break-ask.exp
index ed91d7defb15..90d5044765e4 100644
--- a/gdb/testsuite/gdb.linespec/break-ask.exp
+++ b/gdb/testsuite/gdb.linespec/break-ask.exp
@@ -40,11 +40,11 @@  with_cwd $srcdir/${subdir}/base/two {
     }
 }
 
 if { [gdb_compile "$srcdir/${subdir}/$srcfile $objfile1 $objfile2" \
 		  $binfile executable $opts] != "" } {
-    return -1
+    return
 }
 
 clean_restart ${testfile}
 
 gdb_test_no_output "set multiple-symbols ask"
diff --git a/gdb/testsuite/gdb.linespec/break-asm-file.exp b/gdb/testsuite/gdb.linespec/break-asm-file.exp
index b8dadc15c4ca..c6ae8dea7be9 100644
--- a/gdb/testsuite/gdb.linespec/break-asm-file.exp
+++ b/gdb/testsuite/gdb.linespec/break-asm-file.exp
@@ -26,26 +26,26 @@  set asm_file0 break-asm-file0.S
 # This test can only be run on targets which support DWARF-2 and use gas.
 require dwarf2_support
 
 if  {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
 	  object {debug nowarnings optimize=-O0}] != ""} {
-    return -1
+    return
 }
 
 # Compile .s files without debug information.
 if  {[gdb_compile ${srcdir}/${subdir}/$asm_file0 ${binfile}2.o \
 	  object {nodebug}] != ""} {
-    return -1
+    return
 }
 if  {[gdb_compile ${srcdir}/${subdir}/$asm_file1 ${binfile}3.o \
 	  object {nodebug}] != ""} {
-    return -1
+    return
 }
 
 if  {[gdb_compile [list ${binfile}1.o ${binfile}2.o ${binfile}3.o] \
 	  "${binfile}" executable {}] != ""} {
-    return -1
+    return
 }
 
 clean_restart $execfile
 
 gdb_test "break a/$asm_file0:func" \
diff --git a/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp b/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
index fe7ae40c9a22..a3f99998840f 100644
--- a/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
+++ b/gdb/testsuite/gdb.linespec/cp-completion-aliases.exp
@@ -19,11 +19,11 @@ 
 load_lib completion-support.exp
 
 standard_testfile .cc
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
-    return -1
+    return
 }
 
 # Disable the completion limit for the whole testcase.
 gdb_test_no_output "set max-completions unlimited"
 
diff --git a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
index b12f14da1543..c82410e29325 100644
--- a/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
+++ b/gdb/testsuite/gdb.linespec/cp-replace-typedefs-ns-template.exp
@@ -21,11 +21,11 @@  load_lib completion-support.exp
 
 standard_testfile .cc
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 	 {debug c++ additional_flags=-std=c++11}]} {
-    return -1
+    return
 }
 
 # Disable the completion limit for the whole testcase.
 gdb_test_no_output "set max-completions unlimited"
 
diff --git a/gdb/testsuite/gdb.linespec/cpcompletion.exp b/gdb/testsuite/gdb.linespec/cpcompletion.exp
index 14eb1a68c81a..96c7a968ed6c 100644
--- a/gdb/testsuite/gdb.linespec/cpcompletion.exp
+++ b/gdb/testsuite/gdb.linespec/cpcompletion.exp
@@ -28,19 +28,19 @@  lappend opts additional_flags=-std=c++11
 set flags {}
 lappend flags debug
 
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile $srcfile2 $srcfile3 $srcfile4] $opts]} {
-    return -1
+    return
 }
 
 # Tests below are about tab-completion, which doesn't work if readline
 # library isn't used.  Check it first.
 
 if { ![readline_is_used] } {
     untested "no tab completion support without readline"
-    return -1
+    return
 }
 
 #
 # Some convenience procedures for testing template parameter list
 # completion.
diff --git a/gdb/testsuite/gdb.linespec/cpexplicit.exp b/gdb/testsuite/gdb.linespec/cpexplicit.exp
index b5dbc6dceece..8c9de2aa8991 100644
--- a/gdb/testsuite/gdb.linespec/cpexplicit.exp
+++ b/gdb/testsuite/gdb.linespec/cpexplicit.exp
@@ -20,11 +20,11 @@  require allow_cplus_tests
 standard_testfile .cc
 set exefile $testfile
 
 if {[prepare_for_testing "failed to prepare" $exefile $srcfile \
 	 {c++ debug nowarnings}]} {
-    return -1
+    return
 }
 
 # Wrap this whole test in a namespace to avoid contaminating other tests.
 namespace eval $testfile {
     upvar #0 ::srcfile srcfile
@@ -88,11 +88,11 @@  namespace eval $testfile {
     add linespecs "-function \"myclass::operator,\"" $location(operator)
 
     # Fire up gdb.
     if {![runto_main]} {
 	namespace delete $testfile
-	return -1
+	return
     }
 
     # Test explicit linespecs, with and without conditions.
     foreach linespec $linespecs(linespecs) loc_pattern $linespecs(locations) {
 	# Test the linespec
diff --git a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
index 6399f252d71d..80c8a3937e11 100644
--- a/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-abi-tag.exp
@@ -29,19 +29,19 @@  if { [test_compiler_info gcc-*] } {
     require {expr {[gcc_major_version] >= 5}}
 }
 
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile] {c++ debug}]} {
-    return -1
+    return
 }
 
 # Tests below are about tab-completion, which doesn't work if readline
 # library isn't used.  Check it first.
 
 if { ![readline_is_used] } {
     untested "no tab completion support without readline"
-    return -1
+    return
 }
 
 gdb_test_no_output "set max-completions unlimited"
 
 # Check that the explicit location completer manages to find the next
diff --git a/gdb/testsuite/gdb.linespec/cpls-ops.exp b/gdb/testsuite/gdb.linespec/cpls-ops.exp
index 4cef26e6767e..c49afaa9856c 100644
--- a/gdb/testsuite/gdb.linespec/cpls-ops.exp
+++ b/gdb/testsuite/gdb.linespec/cpls-ops.exp
@@ -23,19 +23,19 @@  set flags {}
 lappend flags debug
 lappend flags c++
 
 if {[prepare_for_testing "failed to prepare" $testfile \
 	 [list $srcfile] $flags]} {
-    return -1
+    return
 }
 
 # Tests below are about tab-completion, which doesn't work if readline
 # library isn't used.  Check it first.
 
 if { ![readline_is_used] } {
     untested "no tab completion support without readline"
-    return -1
+    return
 }
 
 gdb_test_no_output "set max-completions unlimited"
 
 # Check that the explicit location completer manages to find the next
diff --git a/gdb/testsuite/gdb.linespec/errors.exp b/gdb/testsuite/gdb.linespec/errors.exp
index 8f60f0eca30b..8e69dd6fa058 100644
--- a/gdb/testsuite/gdb.linespec/errors.exp
+++ b/gdb/testsuite/gdb.linespec/errors.exp
@@ -17,11 +17,11 @@ 
 
 # We don't currently need our own test case for testing, so grab
 # another one.
 
 if {[prepare_for_testing "failed to prepare" linespecs keywords.c]} {
-  return -1
+    return
 }
 
 # PR gdb/12843
 gdb_test "list c:/foo/bar/baz.c:1" "No source file named c:/foo/bar/baz.c."
 gdb_test "list c:/foo/bar/baz.c" "Function \"c:/foo/bar/baz.c\" not defined."
diff --git a/gdb/testsuite/gdb.linespec/explicit.exp b/gdb/testsuite/gdb.linespec/explicit.exp
index faee27bab4a5..ccf74d3863d6 100644
--- a/gdb/testsuite/gdb.linespec/explicit.exp
+++ b/gdb/testsuite/gdb.linespec/explicit.exp
@@ -25,11 +25,11 @@  lappend opts debug
 lappend opts nowarnings
 lappend opts additional_flags=-nostdlib
 
 if {[prepare_for_testing "failed to prepare" $exefile \
 	 [list $srcfile $srcfile2 $srcfile3] $opts]} {
-    return -1
+    return
 }
 
 # Wrap the entire test in a namespace to avoid contaminating other tests.
 namespace eval $testfile {
     upvar #0 ::srcfile srcfile
@@ -96,11 +96,11 @@  namespace eval $testfile {
     add linespecs "-function myfunction -label top -line 3" $location(top)
     add linespecs "-line 25" $location(normal)
 
     # Fire up gdb.
     if {![runto_main]} {
-	return -1
+	return
     }
 
     # Turn off queries
     gdb_test_no_output "set confirm off"
 
diff --git a/gdb/testsuite/gdb.linespec/keywords.exp b/gdb/testsuite/gdb.linespec/keywords.exp
index 36069868f444..ae9380575cf6 100644
--- a/gdb/testsuite/gdb.linespec/keywords.exp
+++ b/gdb/testsuite/gdb.linespec/keywords.exp
@@ -17,15 +17,15 @@ 
 
 standard_testfile
 set exefile $testfile
 
 if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug}]} {
-    return -1
+    return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 # Turn off pending breakpoints to facilitate testing errors.
 gdb_test_no_output "set breakpoint pending off"
 
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
index 0345fc5098ef..771dede9bb64 100644
--- a/gdb/testsuite/gdb.linespec/linespec.exp
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -25,11 +25,11 @@  set basetwo base/two/thefile.cc
 require allow_cplus_tests
 
 if {[prepare_for_testing "failed to prepare" $exefile \
 	 [list $srcfile $baseone $basetwo] \
 	 {debug nowarnings c++}]} {
-    return -1
+    return
 }
 
 gdb_test_no_output "set multiple-symbols all" \
     "set multiple-symbols to all for linespec tests"
 
diff --git a/gdb/testsuite/gdb.linespec/ls-dollar.exp b/gdb/testsuite/gdb.linespec/ls-dollar.exp
index 584ea35447e4..a000c5b39695 100644
--- a/gdb/testsuite/gdb.linespec/ls-dollar.exp
+++ b/gdb/testsuite/gdb.linespec/ls-dollar.exp
@@ -20,11 +20,11 @@  set exefile $testfile
 
 require allow_cplus_tests
 
 if {[prepare_for_testing "failed to prepare" $exefile $srcfile \
 	 {debug nowarnings c++}]} {
-    return -1
+    return
 }
 
 gdb_test_no_output "set listsize 1"
 
 set line [gdb_get_line_number {dollar_func}]
diff --git a/gdb/testsuite/gdb.linespec/macro-relative.exp b/gdb/testsuite/gdb.linespec/macro-relative.exp
index b0ac538be69d..99a6dac78921 100644
--- a/gdb/testsuite/gdb.linespec/macro-relative.exp
+++ b/gdb/testsuite/gdb.linespec/macro-relative.exp
@@ -40,9 +40,9 @@  clean_restart ${testfile}
 
 # Test macros respect DW_AT_comp_dir.
 
 # "list header_two_func" does not set exactly the one line we want.
 if {![runto header_two_func]} {
-    return -1
+    return
 }
 
 gdb_test "info macro HEADER" "\r\n#define HEADER 2"
diff --git a/gdb/testsuite/gdb.linespec/skip-two.exp b/gdb/testsuite/gdb.linespec/skip-two.exp
index 0a8af84441a3..3c5e438f1177 100644
--- a/gdb/testsuite/gdb.linespec/skip-two.exp
+++ b/gdb/testsuite/gdb.linespec/skip-two.exp
@@ -23,18 +23,18 @@  set basetwo base/two/thefile.cc
 require allow_cplus_tests
 
 if {[prepare_for_testing "failed to prepare" $execfile \
 	 [list $srcfile $baseone $basetwo] \
 	 {debug nowarnings c++}]} {
-    return -1
+    return
 }
 
 gdb_test "skip function dupname" \
 	 {Function dupname will be skipped when stepping\.}
 
 if {![runto_main]} {
-    return -1
+    return
 }
 
 set test "dupname ignored from main"
 gdb_test_multiple "step" $test {
     -re "^step\r\ndupname .*\r\n$gdb_prompt $" {
@@ -62,11 +62,11 @@  gdb_test_no_output "skip delete 1"
 
 gdb_test "skip file thefile.cc" \
 	 {File thefile\.cc will be skipped when stepping\.}
 
 if {![runto_main]} {
-    return -1
+    return
 }
 
 gdb_test "step" "static int dupname .*" "step into dupname"
 gdb_test "finish" "return dupname.* body_elsewhere.*" "finish from dupname"
 
diff --git a/gdb/testsuite/gdb.linespec/thread.exp b/gdb/testsuite/gdb.linespec/thread.exp
index 30a21e8fe2fd..ab63fe52a1d9 100644
--- a/gdb/testsuite/gdb.linespec/thread.exp
+++ b/gdb/testsuite/gdb.linespec/thread.exp
@@ -18,15 +18,15 @@ 
 
 standard_testfile
 set exefile $testfile
 
 if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug}]} {
-    return -1
+    return
 }
 
 if {![runto_main]} {
-    return 0
+    return
 }
 
 set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
 
 gdb_test "break $srcfile:$bp_location1" \