[llvm-branch-commits] [libcxx] b2b21a2 - Fix gcc warnings: -Wsign-compare, -Wparentheses.

Marek Kurdej via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 25 06:30:11 PST 2020


Author: Marek Kurdej
Date: 2020-11-25T14:38:54+01:00
New Revision: b2b21a20e7bf72117bd3fe5895012016172da213

URL: https://github.com/llvm/llvm-project/commit/b2b21a20e7bf72117bd3fe5895012016172da213
DIFF: https://github.com/llvm/llvm-project/commit/b2b21a20e7bf72117bd3fe5895012016172da213.diff

LOG: Fix gcc warnings: -Wsign-compare, -Wparentheses.

Added: 
    

Modified: 
    libcxx/test/std/experimental/simd/simd.access/default.pass.cpp
    libcxx/test/support/filesystem_test_helper.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/experimental/simd/simd.access/default.pass.cpp b/libcxx/test/std/experimental/simd/simd.access/default.pass.cpp
index 1bc1500ea6a7..2ca5ec4482bf 100644
--- a/libcxx/test/std/experimental/simd/simd.access/default.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.access/default.pass.cpp
@@ -40,12 +40,12 @@ void test_access() {
     assert(a[0] % b[0] == 42 % 4);
     assert(a[0] << b[0] == (42 << 4));
     assert(a[0] >> b[0] == (42 >> 4));
-    assert(a[0] < b[0] == false);
-    assert(a[0] <= b[0] == false);
-    assert(a[0] > b[0] == true);
-    assert(a[0] >= b[0] == true);
-    assert(a[0] == b[0] == false);
-    assert(a[0] != b[0] == true);
+    assert((a[0] < b[0]) == false);
+    assert((a[0] <= b[0]) == false);
+    assert((a[0] > b[0]) == true);
+    assert((a[0] >= b[0]) == true);
+    assert((a[0] == b[0]) == false);
+    assert((a[0] != b[0]) == true);
     assert((a[0] & b[0]) == (42 & 4));
     assert((a[0] | b[0]) == (42 | 4));
     assert((a[0] ^ b[0]) == (42 ^ 4));
@@ -198,12 +198,12 @@ void test_access() {
     assert(a[0] % b[0] == 42 % 4);
     assert(a[0] << b[0] == (42 << 4));
     assert(a[0] >> b[0] == (42 >> 4));
-    assert(a[0] < b[0] == false);
-    assert(a[0] <= b[0] == false);
-    assert(a[0] > b[0] == true);
-    assert(a[0] >= b[0] == true);
-    assert(a[0] == b[0] == false);
-    assert(a[0] != b[0] == true);
+    assert((a[0] < b[0]) == false);
+    assert((a[0] <= b[0]) == false);
+    assert((a[0] > b[0]) == true);
+    assert((a[0] >= b[0]) == true);
+    assert((a[0] == b[0]) == false);
+    assert((a[0] != b[0]) == true);
     assert((a[0] & b[0]) == (42 & 4));
     assert((a[0] | b[0]) == (42 | 4));
     assert((a[0] ^ b[0]) == (42 ^ 4));

diff  --git a/libcxx/test/support/filesystem_test_helper.h b/libcxx/test/support/filesystem_test_helper.h
index 840c6aa3ce51..ad7ade3a1a58 100644
--- a/libcxx/test/support/filesystem_test_helper.h
+++ b/libcxx/test/support/filesystem_test_helper.h
@@ -184,7 +184,9 @@ struct scoped_test_env
 
         filename = sanitize_path(std::move(filename));
 
-        if (size > std::numeric_limits<large_file_offset_t>::max()) {
+        if (size >
+            static_cast<typename std::make_signed<large_file_offset_t>::type>(
+                std::numeric_limits<large_file_offset_t>::max())) {
             fprintf(stderr, "create_file(%s, %ju) too large\n",
                     filename.c_str(), size);
             abort();


        


More information about the llvm-branch-commits mailing list