editeng/source/rtf/svxrtf.cxx         |    4 ++--
 include/comphelper/diagnose_ex.hxx    |    2 +-
 include/o3tl/deleter.hxx              |    2 +-
 include/o3tl/make_shared.hxx          |    2 +-
 include/o3tl/strong_int.hxx           |    4 ++--
 include/rtl/stringutils.hxx           |    4 ++--
 include/sal/types.h                   |    2 +-
 include/tools/ref.hxx                 |    2 +-
 registry/source/reflread.cxx          |    4 ++--
 sal/osl/unx/mutex.cxx                 |   10 +++++-----
 sal/rtl/strtmpl.hxx                   |    2 +-
 sc/source/core/tool/scopetools.cxx    |    2 +-
 sw/source/core/text/possiz.hxx        |    2 +-
 test/source/vclbootstrapprotector.cxx |    4 ++--
 unoidl/source/unoidlprovider.cxx      |    4 ++--
 15 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 3ef807504072fcdf09653f88927683ff4f90e503
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sun Oct 13 21:24:59 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Oct 14 13:07:37 2024 +0200

    version COVERITY conditionals
    
    so there's a recheck on each major if they are still needed
    
    Change-Id: I351f731fe4eaec0ebf735147a9a168cccba3bca5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174883
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index c14574877150..bcb87f6ed6bc 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -985,7 +985,7 @@ SvxRTFItemStackType::SvxRTFItemStackType(
         const EditPosition& rPos )
     : aAttrSet( rPool, pWhichRange )
     , mxStartNodeIdx(rPos.MakeNodeIdx())
-#if !defined(__COVERITY__)
+#if !defined(__COVERITY__) || __COVERITY_MAJOR__ > 2023
     // coverity 2020 has difficulty wrt std::optional leading to bogus 
'Uninitialized scalar variable'
     , mxEndNodeIdx(mxStartNodeIdx)
 #endif
@@ -1001,7 +1001,7 @@ SvxRTFItemStackType::SvxRTFItemStackType(
         bool const bCopyAttr )
     : aAttrSet( *rCpy.aAttrSet.GetPool(), rCpy.aAttrSet.GetRanges() )
     , mxStartNodeIdx(rPos.MakeNodeIdx())
-#if !defined(__COVERITY__)
+#if !defined(__COVERITY__) || __COVERITY_MAJOR__ > 2023
     // coverity 2020 has difficulty wrt std::optional leading to bogus 
'Uninitialized scalar variable'
     , mxEndNodeIdx(mxStartNodeIdx)
 #endif
diff --git a/include/comphelper/diagnose_ex.hxx 
b/include/comphelper/diagnose_ex.hxx
index d3f52055e709..658398db76e3 100644
--- a/include/comphelper/diagnose_ex.hxx
+++ b/include/comphelper/diagnose_ex.hxx
@@ -37,7 +37,7 @@ COMPHELPER_DLLPUBLIC void DbgUnhandledException(const 
css::uno::Any& caughtExcep
 //floods coverity with warnings
 inline css::uno::Any DbgGetCaughtException()
 {
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     try
     {
         return ::cppu::getCaughtException();
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
index 76d8d5a357fd..22140538c2e8 100644
--- a/include/o3tl/deleter.hxx
+++ b/include/o3tl/deleter.hxx
@@ -14,7 +14,7 @@
 
 #include <cstdlib>
 
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
 #define suppress_fun_call_w_exception(expr)                                    
                    \
     do                                                                         
                    \
     {                                                                          
                    \
diff --git a/include/o3tl/make_shared.hxx b/include/o3tl/make_shared.hxx
index 5d4d98e42b3a..a6dc8857fc2d 100644
--- a/include/o3tl/make_shared.hxx
+++ b/include/o3tl/make_shared.hxx
@@ -32,7 +32,7 @@ template <typename T> std::shared_ptr<T> 
make_shared_array(size_t const size)
 */
 template <class T, class... Args> std::shared_ptr<T> make_shared(Args&&... 
args)
 {
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     return std::shared_ptr<T>(new T(std::forward<Args>(args)...), 
o3tl::default_delete<T>());
 #else
     return std::make_shared<T>(std::forward<Args>(args)...);
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
index c0df5f75efc8..f8fc1952dd1c 100644
--- a/include/o3tl/strong_int.hxx
+++ b/include/o3tl/strong_int.hxx
@@ -30,7 +30,7 @@
 namespace o3tl
 {
 
-#if !defined __COVERITY__
+#if !defined(__COVERITY__) || __COVERITY_MAJOR__ > 2023
 
 namespace detail {
 
@@ -100,7 +100,7 @@ public:
         typename std::enable_if<std::is_integral<T>::value, int>::type = 0):
         m_value(value)
     {
-#if !defined __COVERITY__
+#if !defined(__COVERITY__) || __COVERITY_MAJOR__ > 2023
         // catch attempts to pass in out-of-range values early
         assert(detail::isInRange<UNDERLYING_TYPE>(value)
                && "out of range");
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index cd8998eff2e4..8c36b52568e0 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -256,7 +256,7 @@ struct ConstCharArrayDetector< const char[ N ], T >
     static char const * toPointer(char const (& literal)[N]) { return literal; 
}
 };
 
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
 //to silence over zealous warnings that the loop is logically dead
 //for the single char case
 template< typename T >
@@ -317,7 +317,7 @@ struct ConstCharArrayDetector<sal_Unicode const [N], T> {
     { return literal; }
 };
 
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
 //to silence over zealous warnings that the loop is logically dead
 //for the single char case
 template<typename T>
diff --git a/include/sal/types.h b/include/sal/types.h
index b02b26f3361d..eaaf69af250d 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -361,7 +361,7 @@ typedef struct _sal_Sequence
     which won't throw in practice, or where std::terminate is
     an acceptable response if they do
 */
-#if defined(LIBO_INTERNAL_ONLY) && defined(__COVERITY__)
+#if defined(LIBO_INTERNAL_ONLY) && defined(__COVERITY__) && __COVERITY_MAJOR__ 
<= 2023
 #   define COVERITY_NOEXCEPT_FALSE noexcept(false)
 #else
 #   define COVERITY_NOEXCEPT_FALSE
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 65e987ca9c2c..4ee8185dee21 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -212,7 +212,7 @@ public:
     SvCompatWeakRef( ) {}
     SvCompatWeakRef( T* pObj )
                          {  if( pObj ) _xHdl = pObj->GetHdl(); }
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     ~SvCompatWeakRef() COVERITY_NOEXCEPT_FALSE {}
 #endif
     SvCompatWeakRef& operator = ( T * pObj )
diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx
index fe223c7b46cb..844b73166e03 100644
--- a/registry/source/reflread.cxx
+++ b/registry/source/reflread.cxx
@@ -955,7 +955,7 @@ RTParamMode MethodList::getMethodParamMode(sal_uInt16 
index, sal_uInt16 paramInd
     return aMode;
 }
 
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
 extern "C" void __coverity_tainted_data_sanitize__(void *);
 #endif
 
@@ -967,7 +967,7 @@ sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) 
const
     {
         try {
             aCount = readUINT16(m_pIndex[index] + 
calcMethodParamIndex(readUINT16(m_pIndex[index] + METHOD_OFFSET_PARAM_COUNT)));
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
             __coverity_tainted_data_sanitize__(&aCount);
 #endif
         } catch (BlopObject::BoundsError &) {
diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx
index e3786e43a1f4..12e16255ba5b 100644
--- a/sal/osl/unx/mutex.cxx
+++ b/sal/osl/unx/mutex.cxx
@@ -84,7 +84,7 @@ void SAL_CALL osl_destroyMutex(oslMutex pMutex)
     }
 }
 
-#ifdef __COVERITY__
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     extern void __coverity_recursive_lock_acquire__(void*);
     extern void __coverity_recursive_lock_release__(void*);
     extern void __coverity_assert_locked__(void*);
@@ -102,7 +102,7 @@ sal_Bool SAL_CALL osl_acquireMutex(oslMutex pMutex)
             SAL_WARN("sal.osl.mutex", "pthread_mutex_lock failed: " << 
UnixErrnoString(nRet));
             return false;
         }
-#ifdef __COVERITY__
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     __coverity_recursive_lock_acquire__(pMutex);
 #endif
         return true;
@@ -123,7 +123,7 @@ sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex pMutex)
         int nRet = pthread_mutex_trylock(&(pMutex->mutex));
         if ( nRet == 0  )
         {
-#ifdef __COVERITY__
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
             __coverity_recursive_lock_acquire__(pMutex);
 #endif
             result = true;
@@ -135,7 +135,7 @@ sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex pMutex)
 
 sal_Bool SAL_CALL osl_releaseMutex(oslMutex pMutex)
 {
-#ifdef __COVERITY__
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     __coverity_assert_locked__(pMutex);
 #endif
     SAL_WARN_IF(!pMutex, "sal.osl.mutex", "null pMutex");
@@ -149,7 +149,7 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutex pMutex)
             return false;
         }
 
-#ifdef __COVERITY__
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
             __coverity_recursive_lock_release__(pMutex);
 #endif
         return true;
diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index 154e553ad2d4..d13e5f73acd5 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -923,7 +923,7 @@ void newConcat(rtl_tString** ppThis, const C1* pLeft, 
sal_Int32 nLeftLength,
             *ppThis = nullptr;
         else
         {
-#if !defined(__COVERITY__)
+#if !defined(__COVERITY__) || __COVERITY_MAJOR__ > 2023
             throw std::length_error("newConcat");
 #else
             //coverity doesn't report std::bad_alloc as an unhandled exception 
when
diff --git a/sc/source/core/tool/scopetools.cxx 
b/sc/source/core/tool/scopetools.cxx
index 38ca8c25270d..022c553d59d8 100644
--- a/sc/source/core/tool/scopetools.cxx
+++ b/sc/source/core/tool/scopetools.cxx
@@ -86,7 +86,7 @@ 
DelayStartListeningFormulaCells::DelayStartListeningFormulaCells(ScColumn& colum
 
 DelayStartListeningFormulaCells::~DelayStartListeningFormulaCells()
 {
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     try
     {
         mColumn.GetDoc().EnableDelayStartListeningFormulaCells(&mColumn, 
mbOldValue);
diff --git a/sw/source/core/text/possiz.hxx b/sw/source/core/text/possiz.hxx
index f66bd1988ca4..dd7e940bd0eb 100644
--- a/sw/source/core/text/possiz.hxx
+++ b/sw/source/core/text/possiz.hxx
@@ -37,7 +37,7 @@ public:
         , m_nHeight(SwTwips(rSize.Height()))
     {
     }
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
     virtual ~SwPosSize() COVERITY_NOEXCEPT_FALSE {}
 #else
     virtual ~SwPosSize() {}
diff --git a/test/source/vclbootstrapprotector.cxx 
b/test/source/vclbootstrapprotector.cxx
index f6d1b97620ad..568a1928887e 100644
--- a/test/source/vclbootstrapprotector.cxx
+++ b/test/source/vclbootstrapprotector.cxx
@@ -26,13 +26,13 @@ public:
 
 private:
     virtual ~Protector() override {
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
         try {
 #endif
             DeInitVCL();
             // for the 6 tests that use it
             comphelper::ThreadPool::getSharedOptimalPool().shutdown();
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
         } catch (const std::exception& e) {
             SAL_WARN("vcl.app", "Fatal exception: " << e.what());
             std::terminate();
diff --git a/unoidl/source/unoidlprovider.cxx b/unoidl/source/unoidlprovider.cxx
index a0bd744d3c42..9b5dd2b28de5 100644
--- a/unoidl/source/unoidlprovider.cxx
+++ b/unoidl/source/unoidlprovider.cxx
@@ -534,7 +534,7 @@ sal_uInt32 findInMap(
     return off;
 }
 
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
 extern "C" void __coverity_tainted_data_sanitize__(void *);
 #endif
 
@@ -545,7 +545,7 @@ std::vector< OUString > readAnnotations(
     std::vector< OUString > ans;
     if (annotated) {
         sal_uInt32 n = file->read32(offset);
-#if defined(__COVERITY__)
+#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2023
         __coverity_tainted_data_sanitize__(&n);
 #endif
         offset += 4;

Reply via email to