From nobody Tue Aug 06 10:26:26 2024 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WdTxW0jp4z5T93f for ; Tue, 06 Aug 2024 10:26:39 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WdTxW09pmz4Nsp for ; Tue, 6 Aug 2024 10:26:39 +0000 (UTC) (envelope-from eduardo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722939999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=29GLkXl0+ZQBKE7gzdzF/upbHbFiCxC4rssDruyJa8Y=; b=WIAk0lxHIhxN5zb9JsRlIf3HzYNv5fHX+JHUm/ON1gH/bbmP3XtGryOOV8LnbVtlihWn19 W2odDT2LT+EIfOqqan7nAqr2rFxeMqOYtA+hhvfJYImRC6ZKPU5udz++8wJI8mzsTL9yc+ DOyg8yz1w7QF2oKhPi6iBh6CriqdjWRz9fqNAELz9LpeuVa7nLo/78IhRaJT2jW3AwyLg2 OKhFdkqXPxZRXFXlsmDuJoX9qhfXTChPFloQmMA/cpxqYTkiYRm1IM80xNb2wTk8yPagAv svCWmuhAyenkY0kpHVZcH69GxDShKrF+Zqp4GDXG8uwBSOZo0xpYB/jGktn8cg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722939999; a=rsa-sha256; cv=none; b=DhaHEmvddksAGOqz9EjhtF6Kf3+96yUZuD/Y7jEUZ0QPY8dTELKSRtsqw3I6NTMcvkbH0p v3nOLtfkhh81wyxnxmILSUwUKkXyXMNRE64vWrZbp8PosdW31RSf4gUtDlxSiyUMexJ0r2 zjeu6qGruUGVolF8WRenzNOEFLKByM+MJQG6pqcrqAvdJfCBOHLgYii2ZLtjp1EkTptHQd upemiZj+oFTZHVQ59XUj5NmreZuEpIlvbkYdiyZ18LSMfPYsepvyu14N1man7FzQJhgZ45 /96CRYRlcXZjCnELys5eclHCEM3B02EVkwOXLPcrqycPHSyMxyr9WwER8Qcfxw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722939999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=29GLkXl0+ZQBKE7gzdzF/upbHbFiCxC4rssDruyJa8Y=; b=LEw/8xwV5Nj7d9VW72uFa5e9hhejKK+gONdjg3t1QIaze959xPsjFcWiThiQokkuf3hE3S 4hpJf2RUYXn4WhnMLe9XlKGiBdt1Urp4YiE8NR5cLKPZQenZ6P9JkSXEO0ZvUD/Hl+qNJ7 b5XNpfzuEOqbxl8RuYe/eLv6ZC62xoigPeFoenraborFiIM+x0nb6xIdtXVhyIn8hr9eoD mQaKlh/Qg5ZjZaX2p7u5alEbFpEa3jVTixDLil3XmR0edZd8xmBf+loU9kQAWHkT3FcHAF nIytwapzenQhdK5fm/rr5dhTaOhxtSKnw9W5Vi4vtJJHf9cFjn3TajheNODFtQ== Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) (Authenticated sender: eduardo) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WdTxV6mGyz17S1 for ; Tue, 6 Aug 2024 10:26:38 +0000 (UTC) (envelope-from eduardo@freebsd.org) Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-e0885b4f1d5so364946276.1 for ; Tue, 06 Aug 2024 03:26:38 -0700 (PDT) X-Gm-Message-State: AOJu0YxQlHHhyKbniT6cjUCISMn9b81xVM7RrZfnM6Flw7pXzLJxi6Fp uFN818+zScOUWjNSYQDoL6T3d1Lkl7TNQkDwiZRf6aRR7doKSqJ87k9a5RN67y0ilGZo2UBYWGX QFwv2YeQVSF/OmaX7UMd6la8K7wc= X-Google-Smtp-Source: AGHT+IHzW9b4bIELGirzBfwht+oYPcf/uV0uyyDxk/tVHm1iz4sMpKUvabImqyCjJ29SIbRSf2qkV742tIDvcx4Nox0= X-Received: by 2002:a25:bdd3:0:b0:e0b:dbba:4be9 with SMTP id 3f1490d57ef6-e0bde2c206emr14706390276.7.1722939997831; Tue, 06 Aug 2024 03:26:37 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 From: Nuno Teixeira Date: Tue, 6 Aug 2024 11:26:26 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Fall back to fast_float when C++ stdlib doesn't provide from_chars for floats To: FreeBSD CURRENT Content-Type: multipart/alternative; boundary="0000000000008a53b8061f013a01" --0000000000008a53b8061f013a01 Content-Type: text/plain; charset="UTF-8" Hello all, On deskutils/treesheets port, upstream did some updated that broke build. After investigating it upstream says we are building with an outdated C++ standard lib. To fix it, I'm using a fall back to fast_float as we see in main PR: https://github.com/aardappel/treesheets/issues/686 As I don't have skills to understand why this fix works, I'd like to have some expert opinion on this fix since I don't know if this will be supported in the furure. Resuming we added __FreeBSD__ to fall back in code already present: template T parse_float(string_view sv, const char **end = nullptr) { // FIXME: Upgrade compilers for these platforms on CI. - #if defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) + #if defined(__APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__FreeBSD__) auto &term = *(char *)(sv.data() + sv.size()); auto orig = term; term = 0; auto v = (T)strtod(sv.data(), (char **)end); term = orig; return v; #else T val = 0; auto res = from_chars(sv.data(), sv.data() + sv.size(), val); if (end) *end = res.ptr; return val; #endif } Commit is https://cgit.freebsd.org/ports/commit/?id=4ffd449f0cfdbef7d1c78442ad3ea0be9ab12ea3 Thanks, -- Nuno Teixeira FreeBSD UNIX: Web: https://FreeBSD.org --0000000000008a53b8061f013a01 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello all,

On deskutils/tree= sheets port, upstream did some updated that broke build.
After in= vestigating it upstream says we are building with an outdated C++ standard = lib.

To fix it, I'm using a fall back to fast_= float as we see in main PR:


As I don= 9;t have skills to understand why this fix works, I'd like to have some= expert opinion on this fix since I don't know if this will be supporte= d in the furure.

Resuming we added __FreeBSD__= to fall back in code already present:

<snip>= ;
template<typename T> T parse_float(string_view sv, co= nst char **end =3D nullptr) {
=C2=A0 =C2=A0 // FIXME: Upgrade compilers = for these platforms on CI.
- =C2=A0 =C2=A0#if defined(__APPLE__) || defi= ned(__ANDROID__) || defined(__EMSCRIPTEN__)
+ =C2=A0 =C2=A0#if defined(_= _APPLE__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__F= reeBSD__)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto &term =3D *(char *)(sv.da= ta() + sv.size());
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto orig =3D term;
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 term =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 auto= v =3D (T)strtod(sv.data(), (char **)end);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 t= erm =3D orig;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return v;
=C2=A0 =C2=A0 #el= se
=C2=A0 =C2=A0 =C2=A0 =C2=A0 T val =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 auto res =3D from_chars(sv.data(), sv.data() + sv.size(), val);
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 if (end) *end =3D res.ptr;
=C2=A0 =C2=A0 =C2=A0= =C2=A0 return val;
=C2=A0 =C2=A0 #endif
}
Thanks,

--
Nuno= Teixeira
FreeBSD UNIX:=C2=A0 <eduardo@FreeBSD.org>=C2=A0 =C2=A0Web:=C2=A0 https://Fr= eeBSD.org
--0000000000008a53b8061f013a01--