[PATCH 2/2] Remove stale -DNO_PROTOTYPES bits from gdb testsuite
Pedro Alves
pedro@palves.net
Thu Jul 2 18:31:28 GMT 2020
From: Pedro Alves <palves@redhat.com>
The gdb.base/call-sc.exp, gdb.base/structs.exp and
gdb.base/structs2.exp testcases still try compiling the sources with
-DNO_PROTOTYPES, but the corresponding sources don't have any #ifdef
NO_PROTOTYPES any longer. Those were removed throughout years ago.
OTOH, gdb.base/ovlymgr.h does check for NO_PROTOTYPES, but no .exp
file compiles it with -DNO_PROTOTYPES.
gdb.base/reread.exp and gdb.base/varargs.exp set a 'prototypes'
global, which is a stale bit left behind when the "try-compiling
without and then with -DNO_PROTOTYPES" logic was around.
gdb/testsuite/ChangeLog:
* gdb.base/call-sc.exp (start_scalars_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/overlays.c: Remove references to PARAMS.
* gdb.base/ovlymgr.h (PARAMS): Delete, and remove all references.
* gdb.base/reread.exp: Don't set 'prototypes' global.
* gdb.base/structs.exp (start_structs_test): Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
* gdb.base/structs2.exp: Don't set 'prototypes' global. Use
prepare_for_testing and don't try compiling with -DNO_PROTOTYPES.
Don't issue "set width 0". Remove gdb_stop_suppressing_tests
call.
* gdb.base/varargs.exp: Don't set 'prototypes' global.
---
gdb/testsuite/gdb.base/call-sc.exp | 15 ++-------------
gdb/testsuite/gdb.base/overlays.c | 8 ++++----
gdb/testsuite/gdb.base/ovlymgr.h | 11 ++---------
gdb/testsuite/gdb.base/reread.exp | 2 --
gdb/testsuite/gdb.base/structs.exp | 15 ++-------------
gdb/testsuite/gdb.base/structs2.exp | 26 ++------------------------
gdb/testsuite/gdb.base/varargs.exp | 2 --
7 files changed, 12 insertions(+), 67 deletions(-)
diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp
index 719000435a7..9544dcc4049 100644
--- a/gdb/testsuite/gdb.base/call-sc.exp
+++ b/gdb/testsuite/gdb.base/call-sc.exp
@@ -55,21 +55,10 @@ proc start_scalars_test { type } {
set testfile "call-sc-${type}"
set binfile [standard_output_file ${testfile}]
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
- # built the second test case since we can't use prototypes
- warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags} additional_flags=-DNO_PROTOTYPES"] != "" } {
- untested "failed to compile"
- return -1
- }
+ if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+ return -1
}
- # Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
-
# Make certain that the output is consistent
with_test_prefix "testfile=$testfile" {
gdb_test_no_output "set print sevenbit-strings"
diff --git a/gdb/testsuite/gdb.base/overlays.c b/gdb/testsuite/gdb.base/overlays.c
index d02ed707cd1..e9dc9a0b586 100644
--- a/gdb/testsuite/gdb.base/overlays.c
+++ b/gdb/testsuite/gdb.base/overlays.c
@@ -3,10 +3,10 @@
#include "ovlymgr.h"
-extern int foo PARAMS((int));
-extern int bar PARAMS((int));
-extern int baz PARAMS((int));
-extern int grbx PARAMS((int));
+extern int foo (int);
+extern int bar (int);
+extern int baz (int);
+extern int grbx (int);
int main ()
{
diff --git a/gdb/testsuite/gdb.base/ovlymgr.h b/gdb/testsuite/gdb.base/ovlymgr.h
index bd0d40a2640..16335056724 100644
--- a/gdb/testsuite/gdb.base/ovlymgr.h
+++ b/gdb/testsuite/gdb.base/ovlymgr.h
@@ -2,16 +2,9 @@
* Sample runtime overlay manager.
*/
-#ifdef NO_PROTOTYPES
-#define PARAMS(paramlist) ()
-#else
-#define PARAMS(paramlist) paramlist
-#endif
-
typedef enum { FALSE, TRUE } bool;
/* Entry Points: */
-bool OverlayLoad PARAMS((unsigned long ovlyno));
-bool OverlayUnload PARAMS((unsigned long ovlyno));
-
+bool OverlayLoad (unsigned long ovlyno);
+bool OverlayUnload (unsigned long ovlyno);
diff --git a/gdb/testsuite/gdb.base/reread.exp b/gdb/testsuite/gdb.base/reread.exp
index e38a5f200d5..f824156cc39 100644
--- a/gdb/testsuite/gdb.base/reread.exp
+++ b/gdb/testsuite/gdb.base/reread.exp
@@ -13,8 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set prototypes 1
-
# Build programs in PIE mode, to reproduce PR 21555.
foreach_with_prefix opts {
{ "" "" }
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index 8eaa36512f2..db258f9c7c7 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -66,21 +66,10 @@ proc start_structs_test { types } {
}
set binfile [standard_output_file ${testfile}]
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
- # built the second test case since we can't use prototypes
- warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags} additional_flags=-DNO_PROTOTYPES"] != "" } {
- untested "failed to compile"
- return -1
- }
+ if { [prepare_for_testing "failed to prepare" $binfile $srcfile $flags] } {
+ return -1
}
- # Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
- gdb_load ${binfile}
-
# Make certain that the output is consistent
with_test_prefix "types=$types" {
gdb_test_no_output "set print sevenbit-strings"
diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp
index 84920c446ad..8a7d9c69378 100644
--- a/gdb/testsuite/gdb.base/structs2.exp
+++ b/gdb/testsuite/gdb.base/structs2.exp
@@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set prototypes 1
standard_testfile .c
# Create and source the file that provides information about the compiler
@@ -22,30 +21,15 @@ if [get_compiler_info] {
return -1
}
-# build the first test case
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- # built the second test case since we can't use prototypes
- warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
- if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
- untested "failed to compile"
- return -1
- }
- set prototypes 0
+if { [prepare_for_testing "failed to prepare" $binfile $srcfile {debug}] } {
+ return -1
}
-# Start with a fresh gdb.
-
-clean_restart ${binfile}
-
-gdb_test_no_output "set width 0"
-
if ![runto_main] then {
fail "can't run to main"
return 0
}
-# Ok, we're finally ready to actually do our tests.
-
gdb_test "f" \
".*bkpt = 0.*" \
"structs2 sanity check"
@@ -67,9 +51,3 @@ if [test_compiler_info gcc-3-*] {
gdb_test "continue" \
".*pr_char=-126.*pr_uchar=120.*pr_short=-32536.*pr_ushort=32000.*bkpt = 1.*" \
"structs2 continue2"
-
-# End of tests.
-
-gdb_stop_suppressing_tests
-
-return 0
diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp
index f6f4f659653..40dcd087a6f 100644
--- a/gdb/testsuite/gdb.base/varargs.exp
+++ b/gdb/testsuite/gdb.base/varargs.exp
@@ -29,8 +29,6 @@
-set prototypes 0
-
standard_testfile .c
if [get_compiler_info] {
--
2.14.5
More information about the Gdb-patches
mailing list