diff options
author | Jordi Olivares Provencio <jordi.olivares-provencio@mongodb.com> | 2022-07-27 14:03:49 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-27 15:00:19 +0000 |
commit | e7d7dfccd104640be5f181238ea53464c042220a (patch) | |
tree | 19d90d7685cf0d14f1585af89908fb490bf4fbc2 /src/mongo/db/record_id.h | |
parent | 85127c1293738670991af5e98204399bb9180fdf (diff) | |
download | mongo-e7d7dfccd104640be5f181238ea53464c042220a.tar.gz |
SERVER-68350 Disable GCC warning for freeing in RecordId destructor
Diffstat (limited to 'src/mongo/db/record_id.h')
-rw-r--r-- | src/mongo/db/record_id.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/record_id.h b/src/mongo/db/record_id.h index 62a17167482..2d57a0b1048 100644 --- a/src/mongo/db/record_id.h +++ b/src/mongo/db/record_id.h @@ -90,11 +90,22 @@ public: RecordId() : _format(Format::kNull){}; +// We believe that due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106092 GCC 11.2 gives an +// invalid error for freeing a non-heap pointer in the destructor. As it is a false positive we +// manually disable the warning here. Note that this pragma doesn't work on Clang so we must verify +// that only GCC can read this. +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfree-nonheap-object" +#endif ~RecordId() { if (_format == Format::kBigStr) { free(_data.heapStr.stringPtr); } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif RecordId(RecordId&& other) { std::memcpy(this, &other, sizeof(RecordId)); |