git: 7be98db80014 - main - net-im/psi: try to unbreak the build against Clang 21.1.8
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 21 Jun 2026 11:42:07 UTC
The branch main has been updated by danfe:
URL: https://cgit.FreeBSD.org/ports/commit/?id=7be98db800147a4b3b98bdd55b0c17595e614b23
commit 7be98db800147a4b3b98bdd55b0c17595e614b23
Author: Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2026-06-21 11:40:48 +0000
Commit: Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2026-06-21 11:40:48 +0000
net-im/psi: try to unbreak the build against Clang 21.1.8
Casting integers to enums outside of the valid range of the
enum is UB in C++17 and apparently no longer tolerated by
modern Clang even for C++11 code. Replace invalidAlgo (255)
with optional<T>-based approach using the C++11-compatible
Sy Brand's template implementation; std::optional is not an
option (pun intended) in this case because this code won't
compile in C++17 mode which it requires.
Obtained from: upstream (psi-im/iris commit 0d35992)
Reported by: pkg-fallout
---
net-im/psi/Makefile | 4 ++
net-im/psi/distinfo | 2 +
.../files/patch-iris_src_xmpp_xmpp-im_types.cpp | 58 ++++++++++++++++++++++
.../patch-iris_src_xmpp_xmpp-im_xmpp__caps.cpp | 12 +++++
.../patch-iris_src_xmpp_xmpp-im_xmpp__status.h | 40 +++++++++++++++
5 files changed, 116 insertions(+)
diff --git a/net-im/psi/Makefile b/net-im/psi/Makefile
index 48515743de2a..e1d09e0f763b 100644
--- a/net-im/psi/Makefile
+++ b/net-im/psi/Makefile
@@ -3,6 +3,7 @@ PORTVERSION= 1.5
PORTREVISION= 3
CATEGORIES= net-im
MASTER_SITES= SF/${PORTNAME}/Psi/${PORTVERSION}
+DISTFILES= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
MAINTAINER= danfe@FreeBSD.org
COMMENT= Qt-based Jabber (XMPP) client
@@ -22,6 +23,9 @@ USE_XORG= ice sm x11 xcb xext xscrnsaver
CMAKE_ARGS= -DIDN_LIBRARY:FILEPATH="${LOCALBASE}/lib/libidn.so" \
-DIDN_INCLUDE_DIR:PATH="${LOCALBASE}/include"
+USE_GITHUB= nodefault
+GH_TUPLE= TartanLlama:optional:v1.1.0:tlo/tlo
+
OPTIONS_DEFINE= WEBENGINE
OPTIONS_RADIO= SPELLCHECK
OPTIONS_RADIO_SPELLCHECK= HUNSPELL ENCHANT
diff --git a/net-im/psi/distinfo b/net-im/psi/distinfo
index be15a93d7f6d..2b9ee9d361b8 100644
--- a/net-im/psi/distinfo
+++ b/net-im/psi/distinfo
@@ -1,3 +1,5 @@
TIMESTAMP = 1599398002
SHA256 (psi-1.5.tar.xz) = 3167350fd43fab4dc948cb5179ca10159a7aa318472d1a8a7617e41f5aa8b5b7
SIZE (psi-1.5.tar.xz) = 2125104
+SHA256 (TartanLlama-optional-v1.1.0_GH0.tar.gz) = 88ece79f3de5ccaec4191951a222f95cc80c4381dafd3163bdb1ff87cedf3118
+SIZE (TartanLlama-optional-v1.1.0_GH0.tar.gz) = 22265
diff --git a/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_types.cpp b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_types.cpp
new file mode 100644
index 000000000000..cb5d4c8b75c0
--- /dev/null
+++ b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_types.cpp
@@ -0,0 +1,58 @@
+--- iris/src/xmpp/xmpp-im/types.cpp.orig 2020-09-06 07:44:45 UTC
++++ iris/src/xmpp/xmpp-im/types.cpp
+@@ -2275,8 +2275,7 @@ bool Subscription::fromString(const QString &s)
+ /**
+ * Default constructor.
+ */
+-CapsSpec::CapsSpec() :
+- hashAlgo_(CapsSpec::invalidAlgo)
++CapsSpec::CapsSpec()
+ {
+ }
+
+@@ -2287,7 +2286,7 @@ CapsSpec::CapsSpec() :
+ * @param ven the version
+ * @param ext the list of extensions (separated by spaces)
+ */
+-CapsSpec::CapsSpec(const QString& node, QCryptographicHash::Algorithm hashAlgo, const QString& ver)
++CapsSpec::CapsSpec(const QString& node, XMPP::CapsSpec::AlgoOpt hashAlgo, const QString& ver)
+ : node_(node)
+ , ver_(ver)
+ , hashAlgo_(hashAlgo)
+@@ -2305,7 +2304,7 @@ CapsSpec::CapsSpec(const DiscoItem &disco, QCryptograp
+ */
+ bool CapsSpec::isValid() const
+ {
+- return !node_.isEmpty() && !ver_.isEmpty() && (hashAlgo_ != CapsSpec::invalidAlgo);
++ return !node_.isEmpty() && !ver_.isEmpty() && hashAlgo_;
+ }
+
+
+@@ -2326,7 +2325,7 @@ const QString& CapsSpec::version() const
+ return ver_;
+ }
+
+-QCryptographicHash::Algorithm CapsSpec::hashAlgorithm() const
++XMPP::CapsSpec::AlgoOpt CapsSpec::hashAlgorithm() const
+ {
+ return hashAlgo_;
+ }
+@@ -2335,8 +2334,7 @@ QDomElement CapsSpec::toXml(QDomDocument *doc) const
+ {
+ QDomElement c = doc->createElement("c");
+ c.setAttribute("xmlns", NS_CAPS);
+- QString algo = cryptoMap().key(hashAlgo_);
+- c.setAttribute("hash",algo);
++ c.setAttribute("hash", hashAlgo_ ? cryptoMap().key(*hashAlgo_) : "");
+ c.setAttribute("node",node_);
+ c.setAttribute("ver",ver_);
+ return c;
+@@ -2351,7 +2349,7 @@ CapsSpec CapsSpec::fromXml(const QDomElement &e)
+ CryptoMap &cm = cryptoMap();
+ CapsSpec cs;
+ if (!node.isEmpty() && !ver.isEmpty()) {
+- QCryptographicHash::Algorithm algo = CapsSpec::invalidAlgo;
++ tl::optional<QCryptographicHash::Algorithm> algo;
+ CryptoMap::ConstIterator it;
+ if (!hashAlgo.isEmpty() && (it = cm.constFind(hashAlgo)) != cm.constEnd()) {
+ algo = it.value();
diff --git a/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__caps.cpp b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__caps.cpp
new file mode 100644
index 000000000000..f66b9a105492
--- /dev/null
+++ b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__caps.cpp
@@ -0,0 +1,12 @@
+--- iris/src/xmpp/xmpp-im/xmpp_caps.cpp.orig 2020-09-06 07:44:45 UTC
++++ iris/src/xmpp/xmpp-im/xmpp_caps.cpp
+@@ -336,7 +336,8 @@ void CapsManager::updateDisco(const Jid &jid, const Di
+ if (!cs.isValid()) {
+ return;
+ }
+- if (item.capsHash(cs.hashAlgorithm()) == cs.version()) {
++ auto algo = cs.hashAlgorithm();
++ if (algo && item.capsHash(*algo) == cs.version()) {
+ CapsRegistry::instance()->registerCaps(cs, item);
+ }
+ }
diff --git a/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__status.h b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__status.h
new file mode 100644
index 000000000000..fd0d7baf54c1
--- /dev/null
+++ b/net-im/psi/files/patch-iris_src_xmpp_xmpp-im_xmpp__status.h
@@ -0,0 +1,40 @@
+--- iris/src/xmpp/xmpp-im/xmpp_status.h.orig 2020-09-06 11:27:29 UTC
++++ iris/src/xmpp/xmpp-im/xmpp_status.h
+@@ -27,6 +27,8 @@
+ #include <QDateTime>
+ #include <QCryptographicHash>
+
++#include "../../../../tlo/include/tl/optional.hpp"
++
+ #include "xmpp_muc.h"
+ #include "xmpp_bitsofbinary.h"
+
+@@ -37,16 +39,16 @@ namespace XMPP
+ {
+ public:
+ typedef QMap<QString,QCryptographicHash::Algorithm> CryptoMap;
+- static const QCryptographicHash::Algorithm invalidAlgo = (QCryptographicHash::Algorithm)255;
++ using AlgoOpt = tl::optional<QCryptographicHash::Algorithm>;
+
+ CapsSpec();
+- CapsSpec(const QString& node, QCryptographicHash::Algorithm hashAlgo, const QString& ver = QString());
++ CapsSpec(const QString& node, AlgoOpt hashAlgo, const QString& ver = QString());
+ CapsSpec(const DiscoItem &disco, QCryptographicHash::Algorithm hashAlgo = QCryptographicHash::Sha1);
+
+ bool isValid() const;
+ const QString& node() const;
+ const QString& version() const;
+- QCryptographicHash::Algorithm hashAlgorithm() const;
++ AlgoOpt hashAlgorithm() const;
+ inline const QStringList &ext() const { return ext_; }
+ QString flatten() const;
+
+@@ -63,7 +65,7 @@ namespace XMPP
+
+ private:
+ QString node_, ver_;
+- QCryptographicHash::Algorithm hashAlgo_;
++ AlgoOpt hashAlgo_;
+ QStringList ext_;
+ };
+