[libcxx] r315809 - Placate unused variable warnings uncovered by improvements to clang's -Wunused-variable

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 14 08:52:38 PDT 2017


Author: d0k
Date: Sat Oct 14 08:52:38 2017
New Revision: 315809

URL: http://llvm.org/viewvc/llvm-project?rev=315809&view=rev
Log:
Placate unused variable warnings uncovered by improvements to clang's -Wunused-variable

Modified:
    libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
    libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
    libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp
    libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
    libcxx/trunk/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
    libcxx/trunk/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
    libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
    libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
    libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
    libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
    libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
    libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
    libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp
    libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
    libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
    libcxx/trunk/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
    libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
    libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
    libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
    libcxx/trunk/test/std/utilities/utility/synopsis.pass.cpp

Modified: libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/depr/depr.c.headers/complex.h.pass.cpp Sat Oct 14 08:52:38 2017
@@ -18,4 +18,5 @@
 int main()
 {
     std::complex<double> d;
+    (void)d;
 }

Modified: libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/depr/depr.c.headers/tgmath_h.pass.cpp Sat Oct 14 08:52:38 2017
@@ -18,6 +18,7 @@
 int main()
 {
     std::complex<double> cd;
+    (void)cd;
     double x = sin(1.0);
     (void)x; // to placate scan-build
 }

Modified: libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/numerics/complex.number/ccmplx/ccomplex.pass.cpp Sat Oct 14 08:52:38 2017
@@ -18,4 +18,5 @@
 int main()
 {
     std::complex<double> d;
+    (void)d;
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/complex.h.pass.cpp Sat Oct 14 08:52:38 2017
@@ -14,4 +14,5 @@
 int main()
 {
     std::complex<double> d;
+    (void)d;
 }

Modified: libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp (original)
+++ libcxx/trunk/test/std/depr/depr.c.headers/tgmath_h.pass.cpp Sat Oct 14 08:52:38 2017
@@ -14,6 +14,7 @@
 int main()
 {
     std::complex<double> cd;
+    (void)cd;
     double x = sin(1.0);
     (void)x; // to placate scan-build
 }

Modified: libcxx/trunk/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/optional/optional.syn/optional_includes_initializer_list.pass.cpp Sat Oct 14 08:52:38 2017
@@ -19,4 +19,5 @@ int main()
     using std::experimental::optional;
 
     std::initializer_list<int> list;
+    (void)list;
 }

Modified: libcxx/trunk/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp (original)
+++ libcxx/trunk/test/std/experimental/utilities/tuple/header.tuple.synop/includes.pass.cpp Sat Oct 14 08:52:38 2017
@@ -16,4 +16,5 @@
 int main()
 {
   std::tuple<int> x(1);
+  (void)x;
 }

Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.const/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -25,6 +25,7 @@ void
 test()
 {
     std::move_iterator<It> r;
+    (void)r;
 }
 
 int main()
@@ -38,6 +39,7 @@ int main()
 #if TEST_STD_VER > 14
     {
     constexpr std::move_iterator<const char *> it;
+    (void)it;
     }
 #endif
 }

Modified: libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.cons/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -25,6 +25,7 @@ void
 test()
 {
     std::reverse_iterator<It> r;
+    (void)r;
 }
 
 int main()
@@ -37,6 +38,7 @@ int main()
 #if TEST_STD_VER > 14
     {
         constexpr std::reverse_iterator<const char *> it;
+        (void)it;
     }
 #endif
 }

Modified: libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istream.iterator/istream.iterator.cons/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -32,6 +32,7 @@ template <typename T, bool isTrivial = s
 struct test_trivial {
 void operator ()() const {
     constexpr std::istream_iterator<T> it;
+    (void)it;
     }
 };
 
@@ -50,6 +51,7 @@ int main()
     assert(it == T());
 #if TEST_STD_VER >= 11
     constexpr T it2;
+    (void)it2;
 #endif
     }
 

Modified: libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/std/iterators/stream.iterators/istreambuf.iterator/istreambuf.iterator.cons/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -30,6 +30,7 @@ int main()
         assert(it == T());
 #if TEST_STD_VER >= 11
         constexpr T it2;
+        (void)it2;
 #endif
     }
     {
@@ -38,6 +39,7 @@ int main()
         assert(it == T());
 #if TEST_STD_VER >= 11
         constexpr T it2;
+        (void)it2;
 #endif
     }
 }

Modified: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.access/access.pass.cpp Sat Oct 14 08:52:38 2017
@@ -57,5 +57,6 @@ int main()
     A test1 = {3, 2, 1};
 #if TEST_STD_VER > 11
     constexpr B test2 = {3, 2, 1};
+    (void)test2;
 #endif  // TEST_STD_VER > 11
 }

Modified: libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.initlist/support.initlist.range/begin_end.pass.cpp Sat Oct 14 08:52:38 2017
@@ -55,5 +55,6 @@ int main()
     A test1 = {3, 2, 1};
 #if TEST_STD_VER > 11
     constexpr B test2 = {3, 2, 1};
+    (void)test2;
 #endif  // TEST_STD_VER > 11
 }

Modified: libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/c.math/ctgmath.pass.cpp Sat Oct 14 08:52:38 2017
@@ -14,6 +14,7 @@
 int main()
 {
     std::complex<double> cd;
+    (void)cd;
     double x = std::sin(0);
     ((void)x); // Prevent unused warning
 }

Modified: libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/complex.number/ccmplx/ccomplex.pass.cpp Sat Oct 14 08:52:38 2017
@@ -14,4 +14,5 @@
 int main()
 {
     std::complex<double> d;
+    (void)d;
 }

Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -20,10 +20,12 @@ int main()
 {
     {
     std::once_flag f;
+    (void)f;
     }
 #if TEST_STD_VER >= 11
     {
     constexpr std::once_flag f;
+    (void)f;
     }
 #endif
 }

Modified: libcxx/trunk/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/optional/optional.syn/optional_includes_initializer_list.pass.cpp Sat Oct 14 08:52:38 2017
@@ -19,4 +19,5 @@ int main()
     using std::optional;
 
     std::initializer_list<int> list;
+    (void)list;
 }

Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/UTypes.pass.cpp Sat Oct 14 08:52:38 2017
@@ -147,6 +147,7 @@ int main()
 #if TEST_STD_VER > 11
     {
         constexpr std::tuple<Empty> t0{Empty()};
+        (void)t0;
     }
     {
         constexpr std::tuple<A, A> t(3, 2);

Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc.pass.cpp Sat Oct 14 08:52:38 2017
@@ -102,6 +102,8 @@ int main()
         using T = NonDefaultConstructible<>;
         T v(42);
         std::tuple<T, T> t(v, v);
+        (void)t;
         std::tuple<T, T> t2(42, 42);
+        (void)t2;
     }
 }

Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/default.pass.cpp Sat Oct 14 08:52:38 2017
@@ -49,6 +49,7 @@ int main()
 {
     {
         std::tuple<> t;
+        (void)t;
     }
     {
         std::tuple<int> t;
@@ -88,6 +89,7 @@ int main()
     }
     {
         constexpr std::tuple<> t;
+        (void)t;
     }
     {
         constexpr std::tuple<int> t;

Modified: libcxx/trunk/test/std/utilities/utility/synopsis.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/synopsis.pass.cpp?rev=315809&r1=315808&r2=315809&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/utility/synopsis.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/utility/synopsis.pass.cpp Sat Oct 14 08:52:38 2017
@@ -17,5 +17,6 @@
 int main()
 {
     std::initializer_list<int> x;
+    (void)x;
 }
 




More information about the cfe-commits mailing list