CaseyCarter created this revision.
CaseyCarter added reviewers: mclow.lists, EricWF, ldionne.
Herald added a subscriber: dexonsmith.

- Silence unused-local-typedef warnings: 
`map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a 
local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused 
when testing non-libc++.

- Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but 
failed to `#include <limits>`.

- Don't test non-type: A "recent" change to 
`meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` 
which is conditionally defined.

- Silence truncation warnings: A few deduction guide tests use 
`unordered_meow<int, /**/ hash<short>>` which triggers sirens and claxons (as 
it should). `midpoint.float.pass` uses `float meow = 3.14;`, which triggers 
bogus truncation warnings.


https://reviews.llvm.org/D68681

Files:
  test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
  test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
  test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
  test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
  test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
  test/std/numerics/c.math/abs.pass.cpp
  test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
  test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp

Index: test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
===================================================================
--- test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
+++ test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
@@ -42,7 +42,7 @@
     ASSERT_SAME_TYPE(Expected, typename std::underlying_type<T>::type);
 #if TEST_STD_VER > 11
     ASSERT_SAME_TYPE(Expected, typename std::underlying_type_t<T>);
-#endif  
+#endif
 }
 
 enum E { V = INT_MIN };
@@ -79,7 +79,9 @@
 //  SFINAE-able underlying_type
 #if TEST_STD_VER > 17
     static_assert( has_type_member<E>::value, "");
+#ifdef TEST_UNSIGNED_UNDERLYING_TYPE
     static_assert( has_type_member<F>::value, "");
+#endif // TEST_UNSIGNED_UNDERLYING_TYPE
     static_assert( has_type_member<G>::value, "");
 
     static_assert(!has_type_member<void>::value, "");
Index: test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
===================================================================
--- test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
+++ test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
@@ -41,7 +41,7 @@
 
     constexpr T maxV = std::numeric_limits<T>::max();
     constexpr T minV = std::numeric_limits<T>::min();
-    
+
 //  Things that can be compared exactly
     static_assert((std::midpoint(T(0), T(0))   == T(0)),   "");
     static_assert((std::midpoint(T(2), T(4))   == T(3)),   "");
@@ -58,7 +58,7 @@
     assert((fptest_close_pct(std::midpoint(T(0.1),  T(0.4)),  T(0.25),     pct)));
 
     assert((fptest_close_pct(std::midpoint(T(11.2345), T(14.5432)), T(12.88885),  pct)));
-    
+
 //  From e to pi
     assert((fptest_close_pct(std::midpoint(T(2.71828182845904523536028747135266249775724709369995),
                                       T(3.14159265358979323846264338327950288419716939937510)),
@@ -86,7 +86,7 @@
 //  TODO
 
 //  Check two values "close to each other"
-    T d1 = 3.14;
+    T d1 = T(3.14);
     T d0 = std::nextafter(d1, T(2));
     T d2 = std::nextafter(d1, T(5));
     assert(d0 < d1);  // sanity checking
Index: test/std/numerics/c.math/abs.pass.cpp
===================================================================
--- test/std/numerics/c.math/abs.pass.cpp
+++ test/std/numerics/c.math/abs.pass.cpp
@@ -9,6 +9,7 @@
 #include <assert.h>
 #include <cmath>
 #include <cstdint>
+#include <limits>
 #include <type_traits>
 
 #include "test_macros.h"
@@ -75,4 +76,3 @@
 
     return 0;
 }
-
Index: test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
===================================================================
--- test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
+++ test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
@@ -56,6 +56,11 @@
 
 #include "test_allocator.h"
 
+#ifdef TEST_COMPILER_C1XX
+#pragma warning(disable: 4242) // '%s': conversion from '%s' to '%s', possible loss of data
+#pragma warning(disable: 4244) // '%s': conversion from '%s' to '%s', possible loss of data
+#endif // TEST_COMPILER_C1XX
+
 int main(int, char**)
 {
     const int expected_s[] = {1, 2, 3, INT_MAX};
Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
===================================================================
--- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
+++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
@@ -56,6 +56,11 @@
 
 #include "test_allocator.h"
 
+#ifdef TEST_COMPILER_C1XX
+#pragma warning(disable: 4242) // '%s': conversion from '%s' to '%s', possible loss of data
+#pragma warning(disable: 4244) // '%s': conversion from '%s' to '%s', possible loss of data
+#endif // TEST_COMPILER_C1XX
+
 int main(int, char**)
 {
     const int expected_s[] = {1, 1, 2, 3, INT_MAX};
Index: test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
===================================================================
--- test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
+++ test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
@@ -64,6 +64,11 @@
 
 #include "test_allocator.h"
 
+#ifdef TEST_COMPILER_C1XX
+#pragma warning(disable: 4242) // '%s': conversion from '%s' to '%s', possible loss of data
+#pragma warning(disable: 4244) // '%s': conversion from '%s' to '%s', possible loss of data
+#endif // TEST_COMPILER_C1XX
+
 using P = std::pair<int, long>;
 using PC = std::pair<const int, long>;
 
Index: test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
===================================================================
--- test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
+++ test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
@@ -57,17 +57,16 @@
 
 void duplicate_keys_test() {
   typedef std::set<int, std::less<int>, test_allocator<int> > Set;
-  typedef test_alloc_base AllocBase;
   {
-    LIBCPP_ASSERT(AllocBase::alloc_count == 0);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 0);
     Set s = {1, 2, 3};
-    LIBCPP_ASSERT(AllocBase::alloc_count == 3);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 3);
     s = {4, 4, 4, 4, 4};
-    LIBCPP_ASSERT(AllocBase::alloc_count == 1);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 1);
     assert(s.size() == 1);
     assert(*s.begin() == 4);
   }
-  LIBCPP_ASSERT(AllocBase::alloc_count == 0);
+  LIBCPP_ASSERT(test_alloc_base::alloc_count == 0);
 }
 
 int main(int, char**) {
Index: test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
===================================================================
--- test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
+++ test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
@@ -75,23 +75,22 @@
 
 void duplicate_keys_test() {
   typedef std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int> > > Map;
-  typedef test_alloc_base AllocBase;
   {
-    LIBCPP_ASSERT(AllocBase::alloc_count == 0);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 0);
     Map s = {{1, 0}, {2, 0}, {3, 0}};
-    LIBCPP_ASSERT(AllocBase::alloc_count == 3);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 3);
     s = {{4, 0}, {4, 0}, {4, 0}, {4, 0}};
-    LIBCPP_ASSERT(AllocBase::alloc_count == 1);
+    LIBCPP_ASSERT(test_alloc_base::alloc_count == 1);
     assert(s.size() == 1);
     assert(s.begin()->first == 4);
   }
-  LIBCPP_ASSERT(AllocBase::alloc_count == 0);
+  LIBCPP_ASSERT(test_alloc_base::alloc_count == 0);
 }
 
 int main(int, char**)
 {
-    test_basic();
-    duplicate_keys_test();
+  test_basic();
+  duplicate_keys_test();
 
   return 0;
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to