From 3714001525301a8b7afc59959f061d737527b43b Mon Sep 17 00:00:00 2001 From: Niklas Korz Date: Sat, 17 May 2025 12:06:37 +0200 Subject: [PATCH] xalanc: fix Clang 19 and GCC 15 compat --- .../xa/xalanc/0001-clang19-gcc15-compat.patch | 48 +++++++++++++++++++ pkgs/by-name/xa/xalanc/package.nix | 10 ++++ 2 files changed, 58 insertions(+) create mode 100644 pkgs/by-name/xa/xalanc/0001-clang19-gcc15-compat.patch diff --git a/pkgs/by-name/xa/xalanc/0001-clang19-gcc15-compat.patch b/pkgs/by-name/xa/xalanc/0001-clang19-gcc15-compat.patch new file mode 100644 index 000000000000..ab6270d8f148 --- /dev/null +++ b/pkgs/by-name/xa/xalanc/0001-clang19-gcc15-compat.patch @@ -0,0 +1,48 @@ +diff --git a/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp b/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp +index 8741cea49..075b1ad4f 100644 +--- a/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp ++++ b/src/xalanc/XMLSupport/XalanOtherEncodingWriter.hpp +@@ -301,43 +301,6 @@ public: + return write(chars, start, length, m_charRefFunctor); + } + +- void +- writeSafe( +- const XalanDOMChar* theChars, +- size_type theLength) +- { +- for(size_type i = 0; i < theLength; ++i) +- { +- const XalanDOMChar ch = theChars[i]; +- +- if (isUTF16HighSurrogate(ch) == true) +- { +- if (i + 1 >= theLength) +- { +- throwInvalidUTF16SurrogateException(ch, 0, getMemoryManager()); +- } +- else +- { +- XalanUnicodeChar value = decodeUTF16SurrogatePair(ch, theChars[i+1], getMemoryManager()); +- +- if (this->m_isPresentable(value)) +- { +- write(value); +- } +- else +- { +- this->writeNumberedEntityReference(value); +- } +- +- ++i; +- } +- } +- else +- { +- write(static_cast(ch)); +- } +- } +- } + + void + write(const XalanDOMChar* theChars) diff --git a/pkgs/by-name/xa/xalanc/package.nix b/pkgs/by-name/xa/xalanc/package.nix index d8e898ab47da..06bd0ba59abf 100644 --- a/pkgs/by-name/xa/xalanc/package.nix +++ b/pkgs/by-name/xa/xalanc/package.nix @@ -18,6 +18,16 @@ stdenv.mkDerivation { sha256 = "sha256:0q1204qk97i9h14vxxq7phcfpyiin0i1zzk74ixvg4wqy87b62s8"; }; + patches = [ + # See https://github.com/llvm/llvm-project/issues/96859 + # xalan-c contains a templated code path that tries to access non-existent methods, + # but before Clang 19 and GCC 15 this was no error as the template was never instantiated. + # Note that the suggested fix of adding "-fdelayed-template-parsing" + # to CXX_FLAGS would be sufficient for Clang 19, but as it would break again + # once we upgrade to GCC 15, we remove the dead code entirely. + ./0001-clang19-gcc15-compat.patch + ]; + nativeBuildInputs = [ cmake ]; buildInputs = [ xercesc