summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-02-10 09:24:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-06-06 14:15:43 +0200
commitd0069e5189f5410e1db7aa395f0754109e872f46 (patch)
tree30c860e8d780c3461c6048be9594f642f03de5de /sal
parentcc2db25645ede743bdc3824fe7d26ea4beda6a96 (diff)
add COVERITY_NOEXCEPT_FALSE
to markup dtors that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do Change-Id: I32b94814e8245372e1d1dc36be0d81e3564042f4 Reviewed-on: https://gerrit.libreoffice.org/38318 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/ustring.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 85ac84a97538..7940d5af1240 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -612,7 +612,13 @@ void rtl_uString_newConcatAsciiL(
assert(right != nullptr);
assert(rightLength >= 0);
if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) {
+#if !defined(__COVERITY__)
throw std::length_error("rtl_uString_newConcatAsciiL");
+#else
+ //coverity doesn't report std::bad_alloc as an unhandled exception when
+ //potentially thrown from destructors but does report std::length_error
+ throw std::bad_alloc();
+#endif
}
sal_Int32 n = left->length + rightLength;
rtl_uString_assign(newString, left);
@@ -634,7 +640,13 @@ void rtl_uString_newConcatUtf16L(
assert(right != nullptr);
assert(rightLength >= 0);
if (left->length > std::numeric_limits<sal_Int32>::max() - rightLength) {
+#if !defined(__COVERITY__)
throw std::length_error("rtl_uString_newConcatUtf16L");
+#else
+ //coverity doesn't report std::bad_alloc as an unhandled exception when
+ //potentially thrown from destructors but does report std::length_error
+ throw std::bad_alloc();
+#endif
}
sal_Int32 n = left->length + rightLength;
rtl_uString_assign(newString, left);