summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-11 09:05:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-11 15:05:43 +0200
commit42ca6e53291e975555cc9cd5ecff25bfea556d7e (patch)
tree787f480e286f67b329a498229d74208c0889eec4
parent3a64d3c02ada298f70ea7bfbb4e4a377b05ad0e8 (diff)
coverity#1401328 silence Uncaught exception
and a bunch more Change-Id: Icdd195d1ddfc0259743892097a65c07277d53fd9 Reviewed-on: https://gerrit.libreoffice.org/52711 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/tools/diagnose_ex.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h
index 31c2b376baa2..9c18d5f51ad4 100644
--- a/include/tools/diagnose_ex.h
+++ b/include/tools/diagnose_ex.h
@@ -33,6 +33,24 @@ TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException,
const char* currentFunction, const char* fileAndLineNo,
const char* area = nullptr, const char* explanatory = nullptr);
+//getCaughtException throws exceptions in never-going-to-happen situations which
+//floods coverity with warnings
+inline css::uno::Any DbgGetCaughtException()
+{
+#if defined(__COVERITY__)
+ try
+ {
+ return ::cppu::getCaughtException();
+ }
+ catch (...)
+ {
+ std::abort();
+ }
+#else
+ return ::cppu::getCaughtException();
+#endif
+}
+
/** reports a caught UNO exception via OSL diagnostics
Note that whenever you use this, it might be an indicator that your error
@@ -40,11 +58,11 @@ TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException,
This takes two optional parameters: area and explanatory
*/
#define DBG_UNHANDLED_EXCEPTION_0_ARGS() \
- DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE );
+ DbgUnhandledException( DbgGetCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE );
#define DBG_UNHANDLED_EXCEPTION_1_ARGS(area) \
- DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, area );
+ DbgUnhandledException( DbgGetCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, area );
#define DBG_UNHANDLED_EXCEPTION_2_ARGS(area, explanatory) \
- DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, area, explanatory );
+ DbgUnhandledException( DbgGetCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, area, explanatory );
#define DBG_UNHANDLED_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
#define DBG_UNHANDLED_FUNC_RECOMPOSER(argsWithParentheses) DBG_UNHANDLED_FUNC_CHOOSER argsWithParentheses