Commit 9c1dcfd9 authored by brucedawson's avatar brucedawson Committed by Commit bot

Suppress incorrect warning

When doing VS 2017 official builds of some targets, including
mksnapshot.exe, a warning about a buffer overrun is shown. After
analysis and discussion with Microsoft it was decided that this warning
is spurious. The warning is:

    warning C4789: buffer 'key' of size 16 bytes will be overrun; 4
    bytes will be written starting at offset 16

Despite the certain language "4 bytes *will* be written..." it is in
fact a heuristic based warning. Suppressing it at this point in the
inlining stack appears to avoid the issues.

R=hablich@chromium.org
BUG=v8:6068

Review-Url: https://codereview.chromium.org/2804033005
Cr-Commit-Position: refs/heads/master@{#44625}
parent aee49387
......@@ -966,6 +966,14 @@ class SeqOneByteSubStringKey : public HashTableKey {
DCHECK(string_->IsSeqOneByteString());
}
// VS 2017 on official builds gives this spurious warning:
// warning C4789: buffer 'key' of size 16 bytes will be overrun; 4 bytes will
// be written starting at offset 16
// https://bugs.chromium.org/p/v8/issues/detail?id=6068
#if defined(V8_CC_MSVC)
#pragma warning(push)
#pragma warning(disable : 4789)
#endif
uint32_t Hash() override {
DCHECK(length_ >= 0);
DCHECK(from_ + length_ <= string_->length());
......@@ -976,6 +984,9 @@ class SeqOneByteSubStringKey : public HashTableKey {
DCHECK(result != 0); // Ensure that the hash value of 0 is never computed.
return result;
}
#if defined(V8_CC_MSVC)
#pragma warning(pop)
#endif
uint32_t HashForObject(Object* other) override {
return String::cast(other)->Hash();
......
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