Commit 6c67cd18 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

Fix gcc error for static_cast the parameters of DCHECK_GT macro to unsigned in list.h.

  The CL #42279 (https://codereview.chromium.org/2619353006 ) caused a gcc error (-Werror=strict-overflow).

  Here is the error message:
  In file included from .././src/globals.h:15:0,
                   from .././src/allocation.h:9,
                   from .././src/profiler/profile-generator.h:9,
                   from ../src/profiler/profile-generator.cc:5:
  .././src/base/logging.h: In member function ‘void v8::internal::ProfileTree::TraverseDepthFirst(Callback*) [with Callback = v8::internal::DeleteNodesCallback]’:
  .././src/base/logging.h:179:70: error: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow]
                             : MakeCheckOpString<Lhs, Rhs>(lhs, rhs, msg);        \
                                                                            ^
  .././src/base/logging.h:191:1: note: in expansion of macro ‘DEFINE_CHECK_OP_IMPL’
   DEFINE_CHECK_OP_IMPL(GT, > )
   ^
    CXX(target) /home/zxli/work/google-v8/v8/out/x87.optdebug/obj.target/v8_base/src/regexp/regexp-macro-assembler.o
  cc1plus: all warnings being treated as errors

  This CL fix it.

BUG=

Review-Url: https://codereview.chromium.org/2632633002
Cr-Commit-Position: refs/heads/master@{#42318}
parent 3badb236
......@@ -65,7 +65,7 @@ class List {
// backing store (e.g. Add).
inline T& operator[](int i) const {
DCHECK_LE(0, i);
DCHECK_GT(length_, i);
DCHECK_GT(static_cast<unsigned>(length_), static_cast<unsigned>(i));
return data_[i];
}
inline T& at(int i) const { return operator[](i); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment