From 7d9f4ebabf22f106547c9e2cd76c708624b2959a Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Thu, 24 Oct 2024 12:22:56 +0200 Subject: [PATCH] fix compilation on clang 19 --- .github/workflows/branchbuild.yml | 4 ++-- CHANGELOG.rst | 7 +++++++ CMakeLists.txt | 2 +- extern/rapidfuzz-cpp | 2 +- src/rapidfuzz/__init__.py | 2 +- src/rapidfuzz/cpp_common.hpp | 4 ++-- src/rapidfuzz/utils.hpp | 9 ++++----- src/rapidfuzz/utils_cpp.hpp | 9 +++------ 8 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/branchbuild.yml b/.github/workflows/branchbuild.yml index ca581fc..8d63939 100644 --- a/.github/workflows/branchbuild.yml +++ b/.github/workflows/branchbuild.yml @@ -60,7 +60,7 @@ jobs: run: | git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git cd rapidfuzz-cpp - git checkout v3.0.5 + git checkout v3.1.0 mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . @@ -104,7 +104,7 @@ jobs: run: | git clone https://github.com/rapidfuzz/rapidfuzz-cpp.git cd rapidfuzz-cpp - git checkout v3.0.5 + git checkout v3.1.0 mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7291b9a..44d9958 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ Changelog --------- +[3.10.1] - 2024-10-24 +^^^^^^^^^^^^^^^^^^^^^ +Fixed +~~~~~ +- fix compilation on clang-19 + + [3.10.0] - 2024-09-21 ^^^^^^^^^^^^^^^^^^^^^ Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ef8b3d..f56056f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,7 +110,7 @@ else() add_library(Taskflow::Taskflow ALIAS Taskflow) endif() -find_package(rapidfuzz 3.0.5 QUIET) +find_package(rapidfuzz 3.1.0 QUIET) if(rapidfuzz_FOUND) message(STATUS "Using system supplied version of rapidfuzz-cpp") else() diff --git a/extern/rapidfuzz-cpp b/extern/rapidfuzz-cpp index cbdf843..05036b7 160000 --- a/extern/rapidfuzz-cpp +++ b/extern/rapidfuzz-cpp @@ -1 +1 @@ -Subproject commit cbdf84388cea0f12d8a02d9bac28d806b178302a +Subproject commit 05036b7055b71017331ce0a95fbbe1fcff399c90 diff --git a/src/rapidfuzz/__init__.py b/src/rapidfuzz/__init__.py index 63e5062..7a72f67 100644 --- a/src/rapidfuzz/__init__.py +++ b/src/rapidfuzz/__init__.py @@ -6,7 +6,7 @@ from __future__ import annotations __author__: str = "Max Bachmann" __license__: str = "MIT" -__version__: str = "3.10.0" +__version__: str = "3.10.1" from rapidfuzz import distance, fuzz, process, utils diff --git a/src/rapidfuzz/cpp_common.hpp b/src/rapidfuzz/cpp_common.hpp index c2987e0..0aed0b0 100644 --- a/src/rapidfuzz/cpp_common.hpp +++ b/src/rapidfuzz/cpp_common.hpp @@ -708,7 +708,7 @@ static inline bool multi_normalized_distance_init(RF_ScorerFunc* self, int64_t s static inline PyObject* opcodes_apply(const rf::Opcodes& ops, const RF_String& str1, const RF_String& str2) { return visitor(str1, str2, [&](auto s1, auto s2) { - auto proc_str = rf::opcodes_apply(ops, s1, s2); + auto proc_str = rf::opcodes_apply_vec(ops, s1, s2); return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size()); }); } @@ -716,7 +716,7 @@ static inline PyObject* opcodes_apply(const rf::Opcodes& ops, const RF_String& s static inline PyObject* editops_apply(const rf::Editops& ops, const RF_String& str1, const RF_String& str2) { return visitor(str1, str2, [&](auto s1, auto s2) { - auto proc_str = rf::editops_apply(ops, s1, s2); + auto proc_str = rf::editops_apply_vec(ops, s1, s2); return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size()); }); } diff --git a/src/rapidfuzz/utils.hpp b/src/rapidfuzz/utils.hpp index b0dc83f..3683c61 100644 --- a/src/rapidfuzz/utils.hpp +++ b/src/rapidfuzz/utils.hpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include uint32_t UnicodeDefaultProcess(uint32_t ch); @@ -80,11 +80,10 @@ int64_t default_process(CharT* str, int64_t len) } template -std::basic_string default_process(std::basic_string s) +std::vector default_process_copy(CharT* str_, int64_t len_) { - std::basic_string str(s); - - int64_t len = default_process(&str[0], str.size()); + std::vector str(str_, str_ + len_); + int64_t len = default_process(str.data(), str.size()); str.resize(len); return str; } diff --git a/src/rapidfuzz/utils_cpp.hpp b/src/rapidfuzz/utils_cpp.hpp index 390e231..28a12d6 100644 --- a/src/rapidfuzz/utils_cpp.hpp +++ b/src/rapidfuzz/utils_cpp.hpp @@ -9,20 +9,17 @@ static inline PyObject* default_process_impl(PyObject* sentence) switch (c_sentence.kind) { case RF_UINT8: { - auto proc_str = default_process( - std::basic_string(static_cast(c_sentence.data), c_sentence.length)); + auto proc_str = default_process_copy(static_cast(c_sentence.data), c_sentence.length); return PyUnicode_FromKindAndData(PyUnicode_1BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size()); } case RF_UINT16: { - auto proc_str = default_process( - std::basic_string(static_cast(c_sentence.data), c_sentence.length)); + auto proc_str = default_process_copy(static_cast(c_sentence.data), c_sentence.length); return PyUnicode_FromKindAndData(PyUnicode_2BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size()); } case RF_UINT32: { - auto proc_str = default_process( - std::basic_string(static_cast(c_sentence.data), c_sentence.length)); + auto proc_str = default_process_copy(static_cast(c_sentence.data), c_sentence.length); return PyUnicode_FromKindAndData(PyUnicode_4BYTE_KIND, proc_str.data(), (Py_ssize_t)proc_str.size()); } // ToDo: for now do not process these elements should be done in some way in the future