From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id A6ED83951CBD for ; Wed, 6 Jan 2021 19:37:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A6ED83951CBD Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-315-6h555y7FNp-Y0sz1YXX16A-1; Wed, 06 Jan 2021 14:37:53 -0500 X-MC-Unique: 6h555y7FNp-Y0sz1YXX16A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBBA7180A08A; Wed, 6 Jan 2021 19:37:51 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-11.ams2.redhat.com [10.36.112.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0088F60875; Wed, 6 Jan 2021 19:37:50 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 106Jblf9914743 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 6 Jan 2021 20:37:47 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 106JbkBC914742; Wed, 6 Jan 2021 20:37:46 +0100 Date: Wed, 6 Jan 2021 20:37:46 +0100 From: Jakub Jelinek To: David Edelsohn Cc: Jonathan Wakely , Iain Sandoe , libstdc++ , GCC Patches , "CHIGOT, CLEMENT" Subject: Re: [PATCH, libstdc++] GLIBCXX_HAVE_INT64_T Message-ID: <20210106193746.GD725145@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2021 19:37:59 -0000 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