diff options
author | Derek Mauro <dmauro@google.com> | 2023-07-25 13:04:25 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-07-25 13:05:05 -0700 |
commit | 511ad6492eabb7797910ce8689577c45f57bce40 (patch) | |
tree | 30dc7f1927894bf57a58e6b17d9445c16c048b61 /absl/base | |
parent | ac39cc1ec6fed8d3738b4df9589803c23d6d1e3a (diff) |
InlinedVector: Fix control-flow-inregrity warning when using a class
with a vtable
The code is getting the pointer, then constructing it on the next
line. Using reinterpret_cast on this pointer is legal according to
https://clang.llvm.org/docs/ControlFlowIntegrity.html#bad-cast-checking,
but it flags it anyway. The docs say it might be necessary for
`allocate()`-type APIs, and recommends adding them to an ignorelist.
Also note that std::addressof is removed. It is unnecessary since
inlined_data is a char-array.
PiperOrigin-RevId: 550972834
Change-Id: Ib224cec330bb6bcb770296de6c91881f404ef531
Diffstat (limited to 'absl/base')
-rw-r--r-- | absl/base/attributes.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/absl/base/attributes.h b/absl/base/attributes.h index cb3f367f..a7f279a0 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h @@ -274,7 +274,7 @@ // // Tells the ControlFlowIntegrity sanitizer to not instrument a given function. // See https://clang.llvm.org/docs/ControlFlowIntegrity.html for details. -#if ABSL_HAVE_ATTRIBUTE(no_sanitize) +#if ABSL_HAVE_ATTRIBUTE(no_sanitize) && defined(__llvm__) #define ABSL_ATTRIBUTE_NO_SANITIZE_CFI __attribute__((no_sanitize("cfi"))) #else #define ABSL_ATTRIBUTE_NO_SANITIZE_CFI |