summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-29 13:49:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-02 08:58:08 +0200
commite075ee967d0c030a22b7699ee54b5cbd49c07c17 (patch)
tree0f4dc5636aec2e8e77e84839d1ec433f11854811 /include
parent5092305fa80f1900d7229df75a30204ecb53daf0 (diff)
give DBG_UNHANDLED_EXCEPTION_WHEN an area parameter
and rename it to DBG_UNHANDLED_EXCEPTION, to make it more like the SAL_WARN-type macros. Use some macro magic to deal with different numbers of arguments. Update the sallogareas plugin to check the area parameter of DBG_UNHANDLED_EXCEPTION. Change-Id: Ie790223244c3484f41acb3679c043fb9b438e7c4 Reviewed-on: https://gerrit.libreoffice.org/52073 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/tools/diagnose_ex.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h
index df71bfa01711..50a65f01a03f 100644
--- a/include/tools/diagnose_ex.h
+++ b/include/tools/diagnose_ex.h
@@ -29,10 +29,9 @@
TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException,
const char* currentFunction, const char* fileAndLineNo,
- const char* explanatory = nullptr);
+ const char* area = nullptr, const char* explanatory = nullptr);
#if OSL_DEBUG_LEVEL > 0
- #include <com/sun/star/configuration/CorruptedConfigurationException.hpp>
#include <cppuhelper/exc_hlp.hxx>
#include <osl/thread.h>
@@ -40,16 +39,25 @@ TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException,
Note that whenever you use this, it might be an indicator that your error
handling is not correct ....
+ This takes two optional parameters: area and explanatory
*/
- #define DBG_UNHANDLED_EXCEPTION() \
- DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE);
+ #define DBG_UNHANDLED_EXCEPTION_0_ARGS() \
+ DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE );
+ #define DBG_UNHANDLED_EXCEPTION_1_ARGS(area) \
+ DbgUnhandledException( ::cppu::getCaughtException(), 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 );
+
+ #define DBG_UNHANDLED_FUNC_CHOOSER(_f1, _f2, _f3, ...) _f3
+ #define DBG_UNHANDLED_FUNC_RECOMPOSER(argsWithParentheses) DBG_UNHANDLED_FUNC_CHOOSER argsWithParentheses
+ #define DBG_UNHANDLED_CHOOSE_FROM_ARG_COUNT(...) DBG_UNHANDLED_FUNC_RECOMPOSER((__VA_ARGS__, DBG_UNHANDLED_EXCEPTION_2_ARGS, DBG_UNHANDLED_EXCEPTION_1_ARGS, DBG_UNHANDLED_EXCEPTION_0_ARGS, ))
+ #define DBG_UNHANDLED_NO_ARG_EXPANDER() ,,DBG_UNHANDLED_EXCEPTION_0_ARGS
+ #define DBG_UNHANDLED_MACRO_CHOOSER(...) DBG_UNHANDLED_CHOOSE_FROM_ARG_COUNT(DBG_UNHANDLED_NO_ARG_EXPANDER __VA_ARGS__ ())
+ #define DBG_UNHANDLED_EXCEPTION(...) DBG_UNHANDLED_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__)
- #define DBG_UNHANDLED_EXCEPTION_WHEN(explain) \
- DbgUnhandledException( ::cppu::getCaughtException(), OSL_THIS_FUNC, SAL_DETAIL_WHERE, explain);
#else // OSL_DEBUG_LEVEL
- #define DBG_UNHANDLED_EXCEPTION()
- #define DBG_UNHANDLED_EXCEPTION_WHEN(explain)
+ #define DBG_UNHANDLED_EXCEPTION(...)
#endif // OSL_DEBUG_LEVEL
/** This macro asserts the given condition (in debug mode), and throws