diff options
author | Vasyl Gello <vasek.gello@gmail.com> | 2020-07-06 18:38:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-06 08:38:06 -0700 |
commit | 515a4052a750dfe6df8d143c8f23cd8aaf51f9d7 (patch) | |
tree | edbe91d354a93d7461423f4275e3af570dfb5878 /include | |
parent | 36fbe6f13e7e3a370edae090ca2292fae45235a9 (diff) | |
download | flatbuffers-515a4052a750dfe6df8d143c8f23cd8aaf51f9d7.tar.gz flatbuffers-515a4052a750dfe6df8d143c8f23cd8aaf51f9d7.tar.bz2 flatbuffers-515a4052a750dfe6df8d143c8f23cd8aaf51f9d7.zip |
Silence false positive "-Wstringop-overflow" on GCC 10.0 to 11.0 (#6020)
Diffstat (limited to 'include')
-rw-r--r-- | include/flatbuffers/base.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/flatbuffers/base.h b/include/flatbuffers/base.h index bfa02666..d83c7756 100644 --- a/include/flatbuffers/base.h +++ b/include/flatbuffers/base.h @@ -381,6 +381,13 @@ T ReadScalar(const void *p) { return EndianScalar(*reinterpret_cast<const T *>(p)); } +// See https://github.com/google/flatbuffers/issues/5950 + +#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + template<typename T> // UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. __supress_ubsan__("alignment") @@ -393,6 +400,10 @@ template<typename T> __supress_ubsan__("alignment") void WriteScalar(void *p, Of *reinterpret_cast<uoffset_t *>(p) = EndianScalar(t.o); } +#if (FLATBUFFERS_GCC >= 100000) && (FLATBUFFERS_GCC < 110000) + #pragma GCC diagnostic pop +#endif + // Computes how many bytes you'd have to pad to be able to write an // "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in // memory). |