[PATCH] D60779: [ADT] llvm::bsearch, binary search for mere mortals
Tianle Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 19 20:18:27 PDT 2019
liutianle added a comment.
hi sammccall, when I run "check-all", some waring/error print out in STLExtrasTest.cpp as follow. My version is llvm:0ee120077 and clang:d87ee8e678. Could you please fix it or guide me how to fix it?
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp: In lambda function:
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:475:58: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
EXPECT_EQ(5u, bsearch(5, 10, [](unsigned X) { return X >= 0; }));
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:162:3: note: in expansion of macro 'GTEST_PRED_FORMAT2_'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest.h:1923:3: note: in expansion of macro 'EXPECT_PRED_FORMAT2'
EXPECT_PRED_FORMAT2(::testing::internal:: \
^
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:475:3: note: in expansion of macro 'EXPECT_EQ'
EXPECT_EQ(5u, bsearch(5, 10, [](unsigned X) { return X >= 0; }));
^
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp: In lambda function:
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:483:67: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
bsearch(V.begin(), V.end(), [](unsigned X) { return X >= 0; }));
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:162:3: note: in expansion of macro 'GTEST_PRED_FORMAT2_'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest.h:1923:3: note: in expansion of macro 'EXPECT_PRED_FORMAT2'
EXPECT_PRED_FORMAT2(::testing::internal:: \
^
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:482:3: note: in expansion of macro 'EXPECT_EQ'
EXPECT_EQ(V.begin(),
^
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp: In lambda function:
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:489:61: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
EXPECT_EQ(V.begin(), bsearch(V, [](unsigned X) { return X >= 0; }));
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:77:52: note: in definition of macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest_pred_impl.h:162:3: note: in expansion of macro 'GTEST_PRED_FORMAT2_'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^
myLLVM/llvm/utils/unittest/googletest/include/gtest/gtest.h:1923:3: note: in expansion of macro 'EXPECT_PRED_FORMAT2'
EXPECT_PRED_FORMAT2(::testing::internal:: \
^
myLLVM/llvm/unittests/ADT/STLExtrasTest.cpp:489:3: note: in expansion of macro 'EXPECT_EQ'
EXPECT_EQ(V.begin(), bsearch(V, [](unsigned X) { return X >= 0; }));
^
-----------------------------------------------------------------------------------------------------------------------------
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60779/new/
https://reviews.llvm.org/D60779
More information about the llvm-commits
mailing list