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

Liu, Tianle L via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 21 19:35:58 PDT 2019


Thank you very much, Sam!


Thanks,
Tianle

From: Sam McCall [mailto:sammccall at google.com]
Sent: Saturday, April 20, 2019 7:55 PM
To: reviews+D60779+public+1dfc1c5f591db94d at reviews.llvm.org
Cc: Ilya Biryukov <ibiryukov at google.com>; gribozavr at gmail.com; Liu, Tianle L <tianle.l.liu at intel.com>; Jan Korous <jkorous at apple.com>; Duncan P. N. Exon Smith <dexonsmith at apple.com>; notstina at gmail.com; llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [PATCH] D60779: [ADT] llvm::bsearch, binary search for mere mortals

Should be fixed by r358811

On Sat, Apr 20, 2019 at 11:55 AM Sam McCall <sammccall at google.com<mailto:sammccall at google.com>> wrote:
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<mailto: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/20190422/75db142b/attachment.html>


More information about the llvm-commits mailing list