summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2025-01-14 11:14:20 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2025-01-14 08:59:07 +0100
commit32fd04f13ae563262fb0fcb03906ebc891151f1b (patch)
tree314fb28f8499c494f921b302d972ee32a4d728eb /include
parent44dfcebde64b9edfa9f50eace34e5e1497ab9314 (diff)
Use o3tl/source_location.hxx in errcode
Change-Id: Ibb4ee84e74ebd501fefa12070c999e5e9da199fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180212 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/errcode.hxx27
1 files changed, 11 insertions, 16 deletions
diff --git a/include/comphelper/errcode.hxx b/include/comphelper/errcode.hxx
index 884a7785f300..865ab5538897 100644
--- a/include/comphelper/errcode.hxx
+++ b/include/comphelper/errcode.hxx
@@ -27,15 +27,10 @@
#include <compare>
#if defined(DBG_UTIL)
-#if __has_include(<version>)
-#include <version>
-#endif
-#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907
-#include <source_location>
-#define LIBO_ERRMSG_USE_SOURCE_LOCATION std
-#elif __has_include(<experimental/source_location>)
-#include <experimental/source_location>
-#define LIBO_ERRMSG_USE_SOURCE_LOCATION std::experimental
+#include <o3tl/source_location.hxx>
+#ifdef LIBO_USE_SOURCE_LOCATION
+// LIBO_USE_SOURCE_LOCATION may be defined without DBG_UTIL, so a separate define is needed
+#define LIBO_ERRMSG_USE_SOURCE_LOCATION
#endif
#endif
@@ -185,15 +180,15 @@ class SAL_WARN_UNUSED ErrCodeMsg
public:
ErrCodeMsg() : mnCode(0), mnDialogMask(DialogMask::NONE) {}
#ifdef LIBO_ERRMSG_USE_SOURCE_LOCATION
- ErrCodeMsg(ErrCode code, const OUString& arg, LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location loc = LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location::current())
+ ErrCodeMsg(ErrCode code, const OUString& arg, o3tl::source_location loc = o3tl::source_location::current())
: mnCode(code), maArg1(arg), mnDialogMask(DialogMask::NONE), moLoc(loc) {}
- ErrCodeMsg(ErrCode code, const OUString& arg1, const OUString& arg2, LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location loc = LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location::current())
+ ErrCodeMsg(ErrCode code, const OUString& arg1, const OUString& arg2, o3tl::source_location loc = o3tl::source_location::current())
: mnCode(code), maArg1(arg1), maArg2(arg2), mnDialogMask(DialogMask::NONE), moLoc(loc) {}
- ErrCodeMsg(ErrCode code, LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location loc = LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location::current())
+ ErrCodeMsg(ErrCode code, o3tl::source_location loc = o3tl::source_location::current())
: mnCode(code), mnDialogMask(DialogMask::NONE), moLoc(loc) {}
- ErrCodeMsg(ErrCode code, const OUString& arg, DialogMask mask, LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location loc = LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location::current())
+ ErrCodeMsg(ErrCode code, const OUString& arg, DialogMask mask, o3tl::source_location loc = o3tl::source_location::current())
: mnCode(code), maArg1(arg), mnDialogMask(mask), moLoc(loc) {}
- ErrCodeMsg(ErrCode code, const OUString& arg1, const OUString& arg2, DialogMask mask, LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location loc = LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location::current())
+ ErrCodeMsg(ErrCode code, const OUString& arg1, const OUString& arg2, DialogMask mask, o3tl::source_location loc = o3tl::source_location::current())
: mnCode(code), maArg1(arg1), maArg2(arg2), mnDialogMask(mask), moLoc(loc) {}
#else
ErrCodeMsg(ErrCode code, const OUString& arg)
@@ -214,7 +209,7 @@ public:
DialogMask GetDialogMask() const { return mnDialogMask; }
#ifdef LIBO_ERRMSG_USE_SOURCE_LOCATION
- const std::optional<LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location> & GetSourceLocation() const { return moLoc; }
+ const std::optional<o3tl::source_location>& GetSourceLocation() const { return moLoc; }
#endif
/** convert to ERRCODE_NONE if it's a warning, else return the error */
@@ -235,7 +230,7 @@ private:
OUString maArg2;
DialogMask mnDialogMask;
#ifdef LIBO_ERRMSG_USE_SOURCE_LOCATION
- std::optional<LIBO_ERRMSG_USE_SOURCE_LOCATION::source_location> moLoc;
+ std::optional<o3tl::source_location> moLoc;
#endif
};