diff options
-rw-r--r-- | gnu/local.mk | 1 | ||||
-rw-r--r-- | gnu/packages/cpp.scm | 28 | ||||
-rw-r--r-- | gnu/packages/patches/scn-fast-float-compat.patch | 48 |
3 files changed, 77 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 70673be262..a84c96b991 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2045,6 +2045,7 @@ dist_patch_DATA = \ %D%/packages/patches/quodlibet-fix-mtime-tests.patch \ %D%/packages/patches/qucs-s-qucsator-rf-search.patch \ %D%/packages/patches/qxlsx-fix-include-directory.patch \ + %D%/packages/patches/scn-fast-float-compat.patch \ %D%/packages/patches/sdcc-disable-non-free-code.patch \ %D%/packages/patches/sdl-pango-api_additions.patch \ %D%/packages/patches/sdl-pango-blit_overflow.patch \ diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm index 39596bd54f..461070c520 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -1719,6 +1719,34 @@ code and retrieving their output.") (home-page "https://github.com/DaanDeMeyer/reproc") (license license:expat))) +(define-public scn + (package + (name "scn") + (version "4.0.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/eliaskosunen/scnlib") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (patches (search-patches "scn-fast-float-compat.patch")) + (sha256 + (base32 "0lnb9r004y75n4s4pd3k58cdcjpcylhdgr5phwja713g3dd40im8")))) + (build-system cmake-build-system) + (arguments + (list #:configure-flags #~(list "-DSCN_USE_EXTERNAL_GTEST=yes" + "-DSCN_USE_EXTERNAL_BENCHMARK=yes" + "-DSCN_USE_EXTERNAL_FAST_FLOAT=yes" + "-DBUILD_SHARED_LIBS=yes"))) + (propagated-inputs (list fast-float)) + (native-inputs (list googletest googlebenchmark)) + (home-page "https://scnlib.dev/") + (synopsis "Type-safe text parsing library") + (description "@code{scn} is a text parsing library for C++. It can +be used as a safe alternative to @code{scanf} or as a fast alternative to +@code{IOStreams}, analogous to @code{fmt}.") + (license license:asl2.0))) + (define-public sobjectizer (package (name "sobjectizer") diff --git a/gnu/packages/patches/scn-fast-float-compat.patch b/gnu/packages/patches/scn-fast-float-compat.patch new file mode 100644 index 0000000000..27c18a3ac8 --- /dev/null +++ b/gnu/packages/patches/scn-fast-float-compat.patch @@ -0,0 +1,48 @@ +From 144a590f6c7861101579069e89dfb1db0ddfec25 Mon Sep 17 00:00:00 2001 +From: Elias Kosunen <elias.kosunen@gmail.com> +Date: Wed, 21 May 2025 23:59:59 +0300 +Subject: [PATCH] Fix incompatibility with newer fast_float + +--- + benchmark/runtime/float/repeated.cpp | 1 - + benchmark/runtime/float/single.cpp | 1 - + src/scn/impl.cpp | 6 ++++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/benchmark/runtime/float/repeated.cpp b/benchmark/runtime/float/repeated.cpp +index 0aa0c39a..8a4de0a1 100644 +--- a/benchmark/runtime/float/repeated.cpp ++++ b/benchmark/runtime/float/repeated.cpp +@@ -210,4 +210,3 @@ static void scan_float_repeated_fastfloat(benchmark::State& state) + } + BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, float); + BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, double); +-BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, long double); +diff --git a/benchmark/runtime/float/single.cpp b/benchmark/runtime/float/single.cpp +index e06cd138..6819621b 100644 +--- a/benchmark/runtime/float/single.cpp ++++ b/benchmark/runtime/float/single.cpp +@@ -185,4 +185,3 @@ static void scan_float_single_fastfloat(benchmark::State& state) + } + BENCHMARK_TEMPLATE(scan_float_single_fastfloat, float); + BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double); +-BENCHMARK_TEMPLATE(scan_float_single_fastfloat, long double); +diff --git a/src/scn/impl.cpp b/src/scn/impl.cpp +index a36117d8..1e38f1f4 100644 +--- a/src/scn/impl.cpp ++++ b/src/scn/impl.cpp +@@ -723,10 +723,12 @@ struct fast_float_impl_base : impl_base { + { + unsigned format_flags{}; + if ((m_options & float_reader_base::allow_fixed) != 0) { +- format_flags |= fast_float::fixed; ++ format_flags |= ++ static_cast<unsigned>(fast_float::chars_format::fixed); + } + if ((m_options & float_reader_base::allow_scientific) != 0) { +- format_flags |= fast_float::scientific; ++ format_flags |= ++ static_cast<unsigned>(fast_float::chars_format::scientific); + } + + return static_cast<fast_float::chars_format>(format_flags);
\ No newline at end of file |