diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-03 14:57:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-05 11:17:45 +0200 |
commit | ee0e19296b959b4545b094f49a8b0c0b546399d7 (patch) | |
tree | 23143651b2cb6f98146730f050c5093edde518d7 /include | |
parent | b3ab7292931fe8fb0411b667de31c68988ce3c94 (diff) |
make DBG_UNHANDLED_EXCEPTION log in non-dbgutl mode, too
So we can use it like SAL_WARN
Change-Id: Ida90f972d2d16723319acbd4a42045c49e687308
Reviewed-on: https://gerrit.libreoffice.org/52320
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.h | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/include/tools/diagnose_ex.h b/include/tools/diagnose_ex.h index 50a65f01a03f..31c2b376baa2 100644 --- a/include/tools/diagnose_ex.h +++ b/include/tools/diagnose_ex.h @@ -26,39 +26,33 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <tools/toolsdllapi.h> +#include <cppuhelper/exc_hlp.hxx> +#include <osl/thread.h> TOOLS_DLLPUBLIC void DbgUnhandledException(const css::uno::Any& caughtException, const char* currentFunction, const char* fileAndLineNo, const char* area = nullptr, const char* explanatory = nullptr); -#if OSL_DEBUG_LEVEL > 0 - #include <cppuhelper/exc_hlp.hxx> - #include <osl/thread.h> - - /** reports a caught UNO exception via OSL diagnostics - - 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_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__) - - -#else // OSL_DEBUG_LEVEL - #define DBG_UNHANDLED_EXCEPTION(...) -#endif // OSL_DEBUG_LEVEL +/** reports a caught UNO exception via OSL diagnostics + + 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_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__) + /** This macro asserts the given condition (in debug mode), and throws an IllegalArgumentException afterwards. |