[PATCH, libstdc++] GLIBCXX_HAVE_INT64_T
Jakub Jelinek
jakub@redhat.com
Wed Jan 6 19:37:46 GMT 2021
On Wed, Jan 06, 2021 at 01:38:25PM -0500, David Edelsohn via Gcc-patches wrote:
> Is this an acceptable solution to determine the value at compile-time?
This looks wrong to me. The fact that long is 64-bit doesn't imply that
int64_t as defined by stdint.h must be long, it could be long long too.
And while e.g. for C it doesn't really matter much whether streamoff
will be long or long long if those two have the same precision,
for C++ it matters a lot (affects mangling etc.).
> diff --git a/libstdc++-v3/include/bits/postypes.h
> b/libstdc++-v3/include/bits/postypes.h
> index cb44cfe1396..81b9c4c6ae5 100644
> --- a/libstdc++-v3/include/bits/postypes.h
> +++ b/libstdc++-v3/include/bits/postypes.h
> @@ -84,10 +84,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> * Note: In versions of GCC up to and including GCC 3.3, streamoff
> * was typedef long.
> */
> -#ifdef _GLIBCXX_HAVE_INT64_T_LONG
> +#if defined(_GLIBCXX_HAVE_INT64_T_LONG) \
> + || defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
> +
> +#if __SIZEOF_LONG__ == 8
> typedef long streamoff;
> -#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)
> +#elif __SIZEOF_LONG_LONG__ == 8
> typedef long long streamoff;
> +#endif
> +
> #elif defined(_GLIBCXX_HAVE_INT64_T)
> typedef int64_t streamoff;
> #else
Jakub
More information about the Libstdc++
mailing list