1
Fork 0
mirror of https://https.git.savannah.gnu.org/git/guix.git/ synced 2025-07-13 10:30:43 +02:00

gnu: Add scn.

* gnu/packages/patches/scn-fast-float-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it here.
* gnu/packages/cpp.scm (scn): New variable.
This commit is contained in:
Liliana Marie Prikler 2025-05-28 14:04:57 +02:00
parent eb5ae31d17
commit b32a47f26c
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
3 changed files with 77 additions and 0 deletions

View file

@ -2045,6 +2045,7 @@ dist_patch_DATA = \
%D%/packages/patches/quodlibet-fix-mtime-tests.patch \ %D%/packages/patches/quodlibet-fix-mtime-tests.patch \
%D%/packages/patches/qucs-s-qucsator-rf-search.patch \ %D%/packages/patches/qucs-s-qucsator-rf-search.patch \
%D%/packages/patches/qxlsx-fix-include-directory.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/sdcc-disable-non-free-code.patch \
%D%/packages/patches/sdl-pango-api_additions.patch \ %D%/packages/patches/sdl-pango-api_additions.patch \
%D%/packages/patches/sdl-pango-blit_overflow.patch \ %D%/packages/patches/sdl-pango-blit_overflow.patch \

View file

@ -1719,6 +1719,34 @@ code and retrieving their output.")
(home-page "https://github.com/DaanDeMeyer/reproc") (home-page "https://github.com/DaanDeMeyer/reproc")
(license license:expat))) (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 (define-public sobjectizer
(package (package
(name "sobjectizer") (name "sobjectizer")

View file

@ -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);