Avoid testcase build failures with -Wunused-value
authorGary Benson <gbenson@redhat.com>
Tue, 23 Jun 2020 11:25:34 +0000 (12:25 +0100)
committerGary Benson <gbenson@redhat.com>
Tue, 23 Jun 2020 11:25:34 +0000 (12:25 +0100)
A number of testcases fail to build with -Wunused-value enabled.
This commit adds dummy values to avoid this.

gdb/testsuite/ChangeLog:

* gdb.cp/namespace.cc: Avoid build failure with -Wunused-value.
* gdb.cp/nsimport.cc: Likewise.
* gdb.cp/nsnested.cc: Likewise.
* gdb.cp/nsnoimports.cc: Likewise.
* gdb.cp/nsusing.cc: Likewise.
* gdb.cp/smartp.cc: Likewise.
* gdb.python/py-pp-integral.c: Likewise.
* gdb.python/py-pp-re-notag.c: Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/namespace.cc
gdb/testsuite/gdb.cp/nsimport.cc
gdb/testsuite/gdb.cp/nsnested.cc
gdb/testsuite/gdb.cp/nsnoimports.cc
gdb/testsuite/gdb.cp/nsusing.cc
gdb/testsuite/gdb.cp/smartp.cc
gdb/testsuite/gdb.python/py-pp-integral.c
gdb/testsuite/gdb.python/py-pp-re-notag.c

index d6c43e65f068dc4a804b6364087495aaf49f09f8..50dc4eae66eb19b70d3b638241edfa62851e1ab5 100644 (file)
@@ -1,3 +1,14 @@
+2020-06-23  Gary Benson <gbenson@redhat.com>
+
+       * gdb.cp/namespace.cc: Avoid build failure with -Wunused-value.
+       * gdb.cp/nsimport.cc: Likewise.
+       * gdb.cp/nsnested.cc: Likewise.
+       * gdb.cp/nsnoimports.cc: Likewise.
+       * gdb.cp/nsusing.cc: Likewise.
+       * gdb.cp/smartp.cc: Likewise.
+       * gdb.python/py-pp-integral.c: Likewise.
+       * gdb.python/py-pp-re-notag.c: Likewise.
+
 2020-06-22  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
        * gdb.base/default-args.exp: New test.
index f918b63de93804601bbb38d9abe8537d75a0912d..1ff34261bd48423b8ad6c679e964a0b482c1e392 100644 (file)
@@ -150,22 +150,22 @@ namespace C
       // plan to have GDB try to print out, just to make sure that the
       // compiler and I agree which ones should be legal!  It's easy
       // to screw up when testing the boundaries of namespace stuff.
-      c;
+      int unused1 = c;
       //cc;
-      C::cc;
-      cd;
+      int unused2 = C::cc;
+      int unused3 = cd;
       //C::D::cd;
-      E::cde;
-      shadow;
+      int unused4 = E::cde;
+      int unused5 = shadow;
       //E::ce;
-      cX;
-      F::cXf;
-      F::cXfX;
-      X;
-      G::Xg;
+      int unused6 = cX;
+      int unused7 = F::cXf;
+      int unused8 = F::cXfX;
+      int unused9 = X;
+      int unusedA = G::Xg;
       //cXOtherFile;
       //XOtherFile;
-      G::XgX;
+      int unusedB = G::XgX;
 
       return;
     }
index 6b180d63b3b4db7316f54655eaa9ffbd7e438691..5fc57b052fe1f79761ec938c9c159e39e9092519 100644 (file)
@@ -13,8 +13,8 @@ namespace{
 
 int main()
 {
-  x;
-  xx;
-  xxx;
+  int unused1 = x;
+  int unused2 = xx;
+  int unused3 = xxx;
   return 0;
 }
index 9723f874d9476ffce88c5eae3e07af0b49c93268..fc3e11fade508dcef5a943f59ec55053ae8abb46 100644 (file)
@@ -15,7 +15,7 @@ namespace C
     int
     second()
     {
-      ab;
+      int unused = ab;
       return 0;
     }
   }
index d1c68abaeacc7150a7497173cf4b486341b4b656..9968c35e68586a765bc244d063dfc0c5bbb9c549 100644 (file)
@@ -18,9 +18,9 @@ namespace A
     }
 
     int first(){
-      _a;
-      ab;
-      C::abc;
+      int unused1 = _a;
+      int unused2 = ab;
+      int unused3 = C::abc;
       return C::second();
     }
   }
@@ -30,8 +30,8 @@ namespace A
 int
 main()
 {
-  A::_a;
-  A::B::ab;
-  A::B::C::abc;
+  int unused1 = A::_a;
+  int unused2 = A::B::ab;
+  int unused3 = A::B::C::abc;
   return A::B::first();
 }
index 72ff9414b1f9bcc848d770c055bed9a86b454e10..980a91acbe60ddf7942aeaf90379d25c5699f643 100644 (file)
@@ -35,7 +35,7 @@ namespace L
   using namespace J;
   int marker8 ()
   {
-    jx;
+    int unused = jx;
     return K::marker9 ();
   }
 }
@@ -53,7 +53,7 @@ namespace I
   int marker7 ()
   {
     using namespace G::H;
-    ghx;
+    int unused = ghx;
     return L::marker8 ();
   }
 }
@@ -69,7 +69,7 @@ namespace E
 using namespace E::F;
 int marker6 ()
 {
-  efx;
+  int unused = efx;
   return I::marker7 ();
 }
 
@@ -92,7 +92,7 @@ namespace D
 using namespace C;
 int marker5 ()
 {
-  cc;
+  int unused = cc;
   return marker6 ();
 }
 
@@ -110,7 +110,7 @@ int marker3 ()
 int marker2 ()
 {
   namespace B = A;
-  B::_a;
+  int unused = B::_a;
   return marker3 ();
 }
 
@@ -134,6 +134,6 @@ int marker1 ()
 int main ()
 {
   using namespace A;
-  _a;
+  int unused = _a;
   return marker1 ();
 }
index 2e71d1a7390c8e3176be4cfe02801789aa8c3620..ed521020c966b59cc3246e51c35848139fa13418 100644 (file)
@@ -131,12 +131,12 @@ int main(){
   sp3->foo(1);
   sp3->foo('a');
 
-  sp4->a;
-  sp4->b;
+  int unused1 = sp4->a;
+  int unused2 = sp4->b;
 
   Type4 *mt4p = &mt4;
-  mt4p->a;
-  mt4p->b;
+  int unused3 = mt4p->a;
+  int unused4 = mt4p->b;
 
   A a;
   B b;
index 5cefc001b4db08af3d2a2bbc34b64b0264dc74c3..eadb466d0cdfeceb9d2b9ec906659660dd3241a6 100644 (file)
 
 typedef long time_t;
 
-static void
+static time_t
 tick_tock (time_t *t)
 {
-  *t++;
+  return *t++;
 }
 
 int
index 5cefc001b4db08af3d2a2bbc34b64b0264dc74c3..eadb466d0cdfeceb9d2b9ec906659660dd3241a6 100644 (file)
 
 typedef long time_t;
 
-static void
+static time_t
 tick_tock (time_t *t)
 {
-  *t++;
+  return *t++;
 }
 
 int
This page took 0.035292 seconds and 4 git commands to generate.