[binutils-gdb] GDB: testsuite: C++: Don't return value from top-level (manual)

Thiago Bauermann via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b67320f2c61e573bce3dba1b35b88239869fd7f2

commit b67320f2c61e573bce3dba1b35b88239869fd7f2
Author: Thiago Jung Bauermann <[email protected]>
Date:   Wed Apr 29 20:04:08 2026 -0300

    GDB: testsuite: C++: Don't return value from top-level (manual)
    
    This patch manually changes "return -1" and "return 0" statements that
    weren't caught by the sed command.
    
    These return statements fall into one of these criteria:
    
    - misaligned line, which is then fixed by this patch;
    - return at top level but inside block such as save_vars,
      with_test_prefix, foreach, gdb_test_multiple.
    
    Some weren't changed because they didn't meet the criteria above, or
    weren't trivial to check.
    
    Approved-By: Tom Tromey <[email protected]>

Diff:
---
 gdb/testsuite/gdb.cp/anon-struct.exp         |  2 +-
 gdb/testsuite/gdb.cp/converts.exp            |  2 +-
 gdb/testsuite/gdb.cp/cp-relocate.exp         |  8 ++++----
 gdb/testsuite/gdb.cp/cpsizeof.exp            |  2 +-
 gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp |  4 ++--
 gdb/testsuite/gdb.cp/fpointer.exp            |  2 +-
 gdb/testsuite/gdb.cp/koenig.exp              |  2 +-
 gdb/testsuite/gdb.cp/method2.exp             |  2 +-
 gdb/testsuite/gdb.cp/nsnested.exp            |  2 +-
 gdb/testsuite/gdb.cp/nsnoimports.exp         |  2 +-
 gdb/testsuite/gdb.cp/oranking.exp            |  2 +-
 gdb/testsuite/gdb.cp/pr10728.exp             | 12 ++++++------
 gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp   |  2 +-
 gdb/testsuite/gdb.cp/save-bp-qualified.exp   |  4 ++--
 gdb/testsuite/gdb.cp/smartp.exp              |  2 +-
 gdb/testsuite/gdb.cp/static-print-quit.exp   |  2 +-
 16 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/anon-struct.exp b/gdb/testsuite/gdb.cp/anon-struct.exp
index e420d75207f..10b7ce6c776 100644
--- a/gdb/testsuite/gdb.cp/anon-struct.exp
+++ b/gdb/testsuite/gdb.cp/anon-struct.exp
@@ -20,7 +20,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 # Clang doesn't add any names for functions within anonymous structures,
diff --git a/gdb/testsuite/gdb.cp/converts.exp b/gdb/testsuite/gdb.cp/converts.exp
index 7d26db9f302..60a732f87ee 100644
--- a/gdb/testsuite/gdb.cp/converts.exp
+++ b/gdb/testsuite/gdb.cp/converts.exp
@@ -16,7 +16,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp
index c42c67a95e7..67a9f21b964 100644
--- a/gdb/testsuite/gdb.cp/cp-relocate.exp
+++ b/gdb/testsuite/gdb.cp/cp-relocate.exp
@@ -21,8 +21,8 @@ append binfile .o
 require allow_cplus_tests
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {c++ debug}] != "" } {
-     untested "failed to compile"
-     return -1
+    untested "failed to compile"
+    return
 }
 
 proc get_func_address { func } {
@@ -67,7 +67,7 @@ gdb_test_multiple "info functions func<.>" "info functions" {
 	    pass "info functions"
 	} else {
 	    fail "info functions"
-	    return -1
+	    return
 	}
     }
 }
@@ -105,7 +105,7 @@ gdb_test_multiple "info file" "info file" {
 	    pass "info file"
 	} else {
 	    fail "info file"
-	    return -1
+	    return
 	}
     }
 }
diff --git a/gdb/testsuite/gdb.cp/cpsizeof.exp b/gdb/testsuite/gdb.cp/cpsizeof.exp
index a43ae6431ac..23981185579 100644
--- a/gdb/testsuite/gdb.cp/cpsizeof.exp
+++ b/gdb/testsuite/gdb.cp/cpsizeof.exp
@@ -19,7 +19,7 @@ standard_testfile .cc
 require allow_cplus_tests
 
 if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}] } {
-     return -1
+    return
 }
 
 if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
index 110970c89b8..e0d34c86a11 100644
--- a/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
+++ b/gdb/testsuite/gdb.cp/expand-psymtabs-cxx.exp
@@ -19,8 +19,8 @@ standard_testfile .cc
 set executable ${testfile}
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {debug c++} ] != "" } {
-     untested "failed to compile"
-     return -1
+    untested "failed to compile"
+    return
 }
 
 clean_restart ${executable}
diff --git a/gdb/testsuite/gdb.cp/fpointer.exp b/gdb/testsuite/gdb.cp/fpointer.exp
index a97eef7e55b..f4f69a0532d 100644
--- a/gdb/testsuite/gdb.cp/fpointer.exp
+++ b/gdb/testsuite/gdb.cp/fpointer.exp
@@ -19,7 +19,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.cp/koenig.exp b/gdb/testsuite/gdb.cp/koenig.exp
index 474c4a95b41..4fd755ad7b7 100644
--- a/gdb/testsuite/gdb.cp/koenig.exp
+++ b/gdb/testsuite/gdb.cp/koenig.exp
@@ -22,7 +22,7 @@ lappend opts additional_flags=-Wno-unused-comparison
 lappend opts additional_flags=-std=c++11
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $opts] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/method2.exp b/gdb/testsuite/gdb.cp/method2.exp
index 4eed2197c36..e64853ab7ae 100644
--- a/gdb/testsuite/gdb.cp/method2.exp
+++ b/gdb/testsuite/gdb.cp/method2.exp
@@ -23,7 +23,7 @@ require allow_cplus_tests
 standard_testfile .cc
 
 if  {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
-     return -1
+    return
 }
 
 if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.cp/nsnested.exp b/gdb/testsuite/gdb.cp/nsnested.exp
index 8c1cef585a8..11b326fa9b9 100644
--- a/gdb/testsuite/gdb.cp/nsnested.exp
+++ b/gdb/testsuite/gdb.cp/nsnested.exp
@@ -16,7 +16,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/nsnoimports.exp b/gdb/testsuite/gdb.cp/nsnoimports.exp
index 3077e447c28..7c9e70ac3bf 100644
--- a/gdb/testsuite/gdb.cp/nsnoimports.exp
+++ b/gdb/testsuite/gdb.cp/nsnoimports.exp
@@ -16,7 +16,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/oranking.exp b/gdb/testsuite/gdb.cp/oranking.exp
index f7a2f463622..1f418a96a7d 100644
--- a/gdb/testsuite/gdb.cp/oranking.exp
+++ b/gdb/testsuite/gdb.cp/oranking.exp
@@ -16,7 +16,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/pr10728.exp b/gdb/testsuite/gdb.cp/pr10728.exp
index 0625d243bd8..2560325ae72 100644
--- a/gdb/testsuite/gdb.cp/pr10728.exp
+++ b/gdb/testsuite/gdb.cp/pr10728.exp
@@ -28,18 +28,18 @@ set tfx [standard_output_file pr10728-x.o]
 set tfy [standard_output_file pr10728-y.o]
 
 if  { [gdb_compile "${srcdir}/${subdir}/$srcfile2" "${tfy}.o" object {c++}] != "" } {
-     untested "failed to compile second object file"
-     return -1
+    untested "failed to compile second object file"
+    return
 }
 
 if  { [gdb_compile "${srcdir}/${subdir}/$srcfile" "${tfx}.o" object {debug c++}] != "" } {
-     untested "failed to compile first object file"
-     return -1
+    untested "failed to compile first object file"
+    return
 }
 
 if  { [gdb_compile "${tfx}.o ${tfy}.o" ${binfile} executable {debug c++}] != "" } {
-     untested "failed to compile"
-     return -1
+    untested "failed to compile"
+    return
 }
 
 clean_restart $::testfile
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
index a21485e215c..ed15018b37f 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-sizeof.exp
@@ -22,7 +22,7 @@ require allow_cplus_tests
 
 if {[prepare_for_testing ${testfile}.exp $testfile $srcfile \
     {debug c++ additional_flags="-std=gnu++11"}] } {
-     return -1
+    return
 }
 
 if {![runto_main]} {
diff --git a/gdb/testsuite/gdb.cp/save-bp-qualified.exp b/gdb/testsuite/gdb.cp/save-bp-qualified.exp
index a6851ba9662..34529027662 100644
--- a/gdb/testsuite/gdb.cp/save-bp-qualified.exp
+++ b/gdb/testsuite/gdb.cp/save-bp-qualified.exp
@@ -38,7 +38,7 @@ proc restart {} {
 
 with_test_prefix "save" {
     if {![restart]} {
-	return -1
+	return
     }
 
     gdb_breakpoint "function" qualified
@@ -56,7 +56,7 @@ with_test_prefix "save" {
 
 with_test_prefix "restore" {
     if {![restart]} {
-	return -1
+	return
     }
 
     # Restore the breakpoints.
diff --git a/gdb/testsuite/gdb.cp/smartp.exp b/gdb/testsuite/gdb.cp/smartp.exp
index 8a79f4385a9..4c04a465e47 100644
--- a/gdb/testsuite/gdb.cp/smartp.exp
+++ b/gdb/testsuite/gdb.cp/smartp.exp
@@ -16,7 +16,7 @@
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
-     return -1
+    return
 }
 
 ############################################
diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp
index 19756f64732..58f4f5283b3 100644
--- a/gdb/testsuite/gdb.cp/static-print-quit.exp
+++ b/gdb/testsuite/gdb.cp/static-print-quit.exp
@@ -34,7 +34,7 @@ gdb_test_multiple "print c" "" {
     -re "\r\n$pagination_prompt$" {
 	# gdb-7.1 did not crash with this testcase but it had the same bug.
 	untested "bug does not reproduce"
-	return 0
+	return
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.