Date: Thu, 29 Jun 2017 23:46:25 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: Mark Millard <markmi@dsl-only.net> Cc: Konstantin Belousov <kostikbel@gmail.com>, Justin Hibbits <jhibbits@FreeBSD.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: head -r320458 (e.g.) amd64 -> powerpc (32-bit) cross-buildworld fails for time libc++ static_asserts and overflow/underflow of long long (system clang/clang++ 4 based build) Message-ID: <C72D03A1-7977-4D18-A93F-3016D56BBA8B@FreeBSD.org> In-Reply-To: <22F5CFA1-E6A9-4C41-BD43-967105B44C49@dsl-only.net> References: <D8AB364D-9E4B-470A-A858-842E73530C3B@dsl-only.net> <5B12D9A6-C9A2-4B0D-B32D-D04D7DB1E3BC@dsl-only.net> <AFCE7DA0-E8D2-4FC7-9E2F-78011E54F1A0@dsl-only.net> <55A1694D-BC40-49AE-BEF7-CEE502126E96@FreeBSD.org> <20170629125407.GM1935@kib.kiev.ua> <22F5CFA1-E6A9-4C41-BD43-967105B44C49@dsl-only.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 29 Jun 2017, at 19:16, Mark Millard <markmi@dsl-only.net> wrote: >=20 > On 2017-Jun-29, at 5:54 AM, Konstantin Belousov <kostikbel at = gmail.com> wrote: >>=20 >> On Thu, Jun 29, 2017 at 12:47:10PM +0200, Dimitry Andric wrote: >>> One nasty problem with this is that it is not possible to figure out = at >>> compile time what the size of time_t is. You always need some sort = of >>> configure-time test, and an external define. >>=20 >> It is arguably possible, with constexpr. >=20 > I took Dimitry's wording as probably referring to > testing the size in the C/C++ preprocessor like > the original code tests for __LP64__ being defined > vs. not to control what it does: extending that to > involve more preprocessor tests to pick from more > code blocks. (But it is a guess given his wording.) Yeah, what I meant is that the code does something like: #if __LP64__ static_assert(whatever, "foo"); #else static_assert(otherthing, "bar"); #endif where __LP64__ was erroneously thought to determine whether time_t was 64-bit. You cannot replace this with something like the following C++11 construct, though: constexpr bool time_t_64bit =3D sizeof(time_t) =3D=3D 8; if (time_t_64bit) static_assert(true, "time_t is OK"); else static_assert(false, "time_t is bad"); because both static assertions will be evaluated at compile time, and one of them will fail. In any case, Eric Fiselier already had some sort of patch lined up, but I slacked off on trying it out. Sorry about that. :) -Dimitry --Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAllVdUkACgkQsF6jCi4glqN3wACfVKTqwhL8YMitgny3Am39EozG vcIAnR4c7W/vYn89hZEtrWmXhek3Dis/ =CeAt -----END PGP SIGNATURE----- --Apple-Mail=_8A2FDD54-3A69-4E51-A000-4009D22E1C4F--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C72D03A1-7977-4D18-A93F-3016D56BBA8B>