Silence bogus GCC -Wstringop-overflow

...seen at least with gcc-15.1.1-2.fc42.x86_64, when doing optimizing LO builds,

> In file included from include/rtl/ustring.h:29,
>                  from include/typelib/typedescription.h:29,
>                  from include/com/sun/star/uno/Type.h:26,
>                  from workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/beans/Property.hdl:6,
>                  from workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/beans/Property.hpp:6,
>                  from configmgr/source/access.cxx:28:
> In member function ‘void configmgr::Access::releaseNondeleting()’,
>     inlined from ‘rtl::Reference<configmgr::ChildAccess> configmgr::Access::getUnmodifiedChild(const rtl::OUString&)’ at configmgr/source/access.cxx:2064:38:
> include/osl/interlck.h:91:57: error: ‘unsigned int __sync_sub_and_fetch_4(volatile void*, unsigned int)’ writing 4 bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=]
>    91 | #    define osl_atomic_decrement(p) __sync_sub_and_fetch((p), 1)
>       |                                     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~
> configmgr/source/access.cxx:134:5: note: in expansion of macro ‘osl_atomic_decrement’
>   134 |     osl_atomic_decrement(&m_refCount);
>       |     ^~~~~~~~~~~~~~~~~~~~
> In member function ‘rtl::Reference<configmgr::ChildAccess> configmgr::Access::getUnmodifiedChild(const rtl::OUString&)’:
> cc1plus: note: destination object is likely at address zero

Change-Id: I0885af282844fecaf4c117df7d24a943b62aa42c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188259
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
This commit is contained in:
Stephan Bergmann
2025-07-24 10:17:04 +02:00
parent c37b49d621
commit 33bb647987
+7
View File
@@ -131,7 +131,14 @@ oslInterlockedCount Access::acquireCounting() {
}
void Access::releaseNondeleting() {
#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 15
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
osl_atomic_decrement(&m_refCount);
#if defined __GNUC__ && !defined __clang__ && __GNUC__ == 15
#pragma GCC diagnostic pop
#endif
}
bool Access::isValue() {