kdiff3/Fix-linking-with-boost-1.75.0.patch

43 lines
1.3 KiB
Diff

From e446ad2f7fd795d7d2afa654262c77cdbc45ea4a Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Tue, 17 Jan 2023 11:33:47 +0100
Subject: [PATCH] Fix linking with boost 1.75.0
Boost 1.75.0 has a bug that causes "multiple definitions" errors in the
linking stage. This was fixed in later versions by declaring some
functions as inline.
See https://github.com/boostorg/safe_numerics/issues/106 .
As a (ugly) workaround, override the function that breaks kdiff3's build
to be inline before including the boost headers (when using 1.75.0).
---
src/TypeUtils.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/TypeUtils.h b/src/TypeUtils.h
index a9c3ba2..ab735ba 100644
--- a/src/TypeUtils.h
+++ b/src/TypeUtils.h
@@ -14,6 +14,17 @@
#include <type_traits>
#include <limits>
+#include <boost/version.hpp>
+#if BOOST_VERSION == 107500
+// prevent multiple definitions of literal_string with boost 1.75
+// see https://github.com/boostorg/safe_numerics/issues/106
+#include <cstdint>
+namespace boost::safe_numerics {
+ enum class safe_numerics_error : std::uint8_t;
+ inline const char * literal_string(const safe_numerics_error & e);
+}
+#endif
+
#include <boost/safe_numerics/automatic.hpp>
#include <boost/safe_numerics/safe_integer.hpp>
--
2.40.1