]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
cmake: suppress -Wmaybe-uninitialized warning in memstore PageSet 63796/head
authorKefu Chai <tchaikov@gmail.com>
Tue, 17 Jun 2025 08:28:57 +0000 (16:28 +0800)
committerKefu Chai <tchaikov@gmail.com>
Wed, 18 Jun 2025 03:26:32 +0000 (11:26 +0800)
commit3277f0559a1a0d3dc48e8b3a6385ce305f5cf6c3
treeb91fa3d130ef47d499fadcaa76b39478b7dafa3c
parente663ede232a82f2b5af31d39d469f59bc72cfd0b
cmake: suppress -Wmaybe-uninitialized warning in memstore PageSet

Suppress GCC-15 false positive warning about uninitialized memory in
Page::operator delete() using placement new pattern.

GCC-15 incorrectly warns about potentially uninitialized data when
using placement new with manual memory management:

```
[409/506] Building CXX object src/os/CMakeFiles/os.dir/memstore/MemStore.cc.o
In file included from /home/kefu/dev/ceph/src/os/memstore/MemStore.h:29,
                 from /home/kefu/dev/ceph/src/os/memstore/MemStore.cc:28:
In static member function ‘static void Page::operator delete(void*)’,
    inlined from ‘void Page::put()’ at /home/kefu/dev/ceph/src/os/memstore/PageSet.h:36:41:
/home/kefu/dev/ceph/src/os/memstore/PageSet.h:83:42: warning: ‘*this.Page::data’ may be used uninitialized [-Wmaybe-uninitialized]
   83 |     delete[] reinterpret_cast<Page*>(p)->data;
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
```

The warning is a false positive: Page instances are constructed using
placement new over pre-allocated memory, requiring manual cleanup of
the underlying data array. This is the intended behavior and memory
is properly initialized. So, in this change we just silence this warning
in CMake after checking its availability.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/os/memstore/CMakeLists.txt