[PATCH] D60779: [ADT] llvm::bsearch, binary search for mere mortals

Sam McCall via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 02:55:29 PDT 2019


Ah sorry, i wasn't building with this warning on.
It's noise here, but i can change the example so it doesn't fire.
Will land that patch later today once i find a computer.

On Sat, Apr 20, 2019, 05:18 Tianle Liu via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190420/c14adbfa/attachment.html>


More information about the llvm-commits mailing list