Commit fc563c87 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

Fix c++17 related warning emitted by gcc

c++17 is being enabled on some platforms:
https://crrev.com/c/3306812
which causes gcc to emit the following warning:
```
error: null argument where non-null required (argument 2)
 memcpy(storage_ + kReturnCount, param_types.data(),
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Unlike clang, gcc is not able to detect if memcpy is actually
being executed or not when src is NULL:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22179

Therefore need to disable this warning at this location.

Change-Id: I44da9f698ef724e39bb9c7d4b235d1004d52f491
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3308916Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Milad Farazmand <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#78182}
parent 092b3cff
......@@ -111,8 +111,15 @@ class CSignatureOf : public CSignature {
std::is_same<decltype(*reps_), decltype(*param_types.data())>::value,
"type mismatch, cannot memcpy");
if (kParamCount > 0) {
#if V8_CC_GNU
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnonnull"
#endif
memcpy(storage_ + kReturnCount, param_types.data(),
sizeof(*storage_) * kParamCount);
#if V8_CC_GNU
#pragma GCC diagnostic pop
#endif
}
}
......
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