Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simark@simark.ca>, Mark Wielaard <mark@klomp.org>,
	gdb-patches@sourceware.org
Subject: [PATCH] Remove stale "register" bits from gdb.cp/misc.cc (Re: [PATCH] Move "register" test out of classes.exp to a separate testcase)
Date: Sat, 22 Aug 2020 18:11:49 +0100	[thread overview]
Message-ID: <9ed2dbe1-9f38-7035-9cbc-457d2f0c7889@palves.net> (raw)
In-Reply-To: <4a45bd6b-2d4c-10c9-03af-2a8be5e37783@palves.net>

On 8/22/20 6:08 PM, Pedro Alves wrote:

> See patch below.  I propose we push this in instead.

And then this on top.

From 4b75bb6d0a2d171f3a1531de2e820c7e32c2ca72 Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Sat, 22 Aug 2020 18:00:55 +0100
Subject: [PATCH] Remove stale "register" bits from gdb.cp/misc.cc

gdb.cp/misc.cc seems to have been originally copied from
gdb.cp/classes.cc.  The testcases that use it, misc.exp and
inherit.exp don't reference the "register" bits anywhere.  Remove
them, since they trigger warnings with newer GCCs, given "register" is
being removed in C++17.

gdb/testsuite/ChangeLog:

	* gdb.cp/inherit.exp: No longer pass -Wno-deprecated-register.
	* gdb.cp/misc.exp: No longer pass -Wno-deprecated-register.
	* gdb.cp/misc.cc (class small, small::method, marker_reg1)
	(register_class): Delete.
	(main): Don't call register_class.
---
 gdb/testsuite/gdb.cp/inherit.exp |  3 +--
 gdb/testsuite/gdb.cp/misc.cc     | 37 -------------------------------------
 gdb/testsuite/gdb.cp/misc.exp    |  3 +--
 3 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 2d4635c96ad..e9549d3ebe0 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -26,8 +26,7 @@ load_lib "cp-support.exp"
 
 standard_testfile misc.cc
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
-	 {debug c++ additional_flags=-Wno-deprecated-register}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile  {debug c++}]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.cp/misc.cc b/gdb/testsuite/gdb.cp/misc.cc
index 41fb9d2f2db..24d40c461ae 100644
--- a/gdb/testsuite/gdb.cp/misc.cc
+++ b/gdb/testsuite/gdb.cp/misc.cc
@@ -511,42 +511,6 @@ typedef struct {
 } tagless_struct;
 tagless_struct v_tagless;
 
-/* Try to get the compiler to allocate a class in a register.  */
-class small {
- public:
-  int x;
-  int method ();
-};
-
-int
-small::method ()
-{
-  return x + 5;
-}
-
-void marker_reg1 () {}
-
-int
-register_class ()
-{
-  /* We don't call any methods for v, so gcc version cygnus-2.3.3-930220
-     might put this variable in a register.  This is a lose, though, because
-     it means that GDB can't call any methods for that variable.  */
-  register small v;
-
-  int i;
-
-  /* Perform a computation sufficiently complicated that optimizing compilers
-     won't optimized out the variable.  If some compiler constant-folds this
-     whole loop, maybe using a parameter to this function here would help.  */
-  v.x = 0;
-  for (i = 0; i < 13; ++i)
-    v.x += i;
-  --v.x; /* v.x is now 77 */
-  marker_reg1 ();
-  return v.x + 5;
-}
-
 void dummy()
 {
   v_bool = true;
@@ -574,7 +538,6 @@ main()
   inheritance1 ();
   inheritance3 ();
   enums1 ();
-  register_class ();
 
   /* FIXME: pmi gets optimized out.  Need to do some more computation with
      it or something.  (No one notices, because the test is xfail'd anyway,
diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp
index 61034bf8088..cd6f0f7070a 100644
--- a/gdb/testsuite/gdb.cp/misc.exp
+++ b/gdb/testsuite/gdb.cp/misc.exp
@@ -19,8 +19,7 @@ if { [skip_cplus_tests] } { continue }
 
 standard_testfile .cc
 
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
-	 {debug c++ additional_flags=-Wno-deprecated-register}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
     return -1
 }
 

base-commit: 33bf4c5c10d246543c7a9a8ba4bbbe173d7f3367
prerequisite-patch-id: 3b9e228c420206fff81de20b3f1eb0e11f6a210b
-- 
2.14.5



  reply	other threads:[~2020-08-22 17:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-22 12:19 [PATCH] gdb/testsuite: ISO C++17 does not allow register storage class specifier Mark Wielaard
2020-08-22 14:54 ` Simon Marchi
2020-08-22 17:08   ` [PATCH] Move "register" test out of classes.exp to a separate testcase (Re: [PATCH] gdb/testsuite: ISO C++17 does not allow register storage class specifier.) Pedro Alves
2020-08-22 17:11     ` Pedro Alves [this message]
2020-08-22 18:53       ` [PATCH] Remove stale "register" bits from gdb.cp/misc.cc (Re: [PATCH] Move "register" test out of classes.exp to a separate testcase) Mark Wielaard
2020-08-22 19:01         ` Simon Marchi
2020-08-22 19:01           ` Simon Marchi
2020-09-13 16:40         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ed2dbe1-9f38-7035-9cbc-457d2f0c7889@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=mark@klomp.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox