From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70847 invoked by alias); 7 May 2018 20:03:04 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 70824 invoked by uid 89); 7 May 2018 20:03:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*wschmidt, HCc:D*fr, H*f:sk:CAH6eHd, prewritten X-Spam-User: qpsmtpd, 3 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 May 2018 20:03:02 +0000 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 230724902F; Mon, 7 May 2018 20:03:01 +0000 (UTC) Received: from localhost (unknown [10.33.36.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77C6F30BA663; Mon, 7 May 2018 20:03:00 +0000 (UTC) Date: Mon, 07 May 2018 20:03:00 -0000 From: Jonathan Wakely To: Tulio Magno Quites Machado Filho Cc: libstdc++ , gcc-patches , wschmidt@linux.vnet.ibm.com, Segher Boessenkool , John David Anglin , Marc Glisse Subject: Re: [PATCHv2] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler Message-ID: <20180507200259.GN20930@redhat.com> References: <20180312190224.19137-1-tuliom@linux.vnet.ibm.com> <20180501143431.GA6267@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YIwHDYD8sUXtBKvt" Content-Disposition: inline In-Reply-To: <20180501143431.GA6267@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2018-05/txt/msg00293.txt.bz2 --YIwHDYD8sUXtBKvt Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-length: 1244 On 01/05/18 15:34 +0100, Jonathan Wakely wrote: >On 12/03/18 16:02 -0300, Tulio Magno Quites Machado Filho wrote: >>Changes since v1: >>- Completely rewrite of the patch to set ENABLE_FLOAT128 at libstdc++ >> build time and undef _GLIBCXX_USE_FLOAT128 when building user code. >> >>--- 8< --- >> >>In order to use __float128 in C++ it's necessary to check if the >>compiler enabled its support too when building user code. >>This patch changes the behavior at libstdc++ build by setting >>ENABLE_FLOAT128, which is used to set the value of the exported macro >>_GLIBCXX_USE_FLOAT128. > >Now that we're in stage 1 we can make this change. The patch looks >right so I'll go ahead and commit it to trunk (it shouldn't interfere >with testing any last-minute fixes needed for gcc-8). > >Thanks for fixing this, Tulio. Previously _GLIBCXX_USE_FLOAT128 would either be defined to 1 or undefined, but after this change it can be defined to 0, and the checks in and were not adjusted to account for that. This patch restores the previous behaviour, so that when __float128 support is not found by configure the macro will be undefined instead of defined to 0. I plan to commit this tomorrow after some more testing. --YIwHDYD8sUXtBKvt Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename="patch.txt" Content-length: 2471 commit aed5af13903fa21632919269c9e7f7c4e02e8887 Author: Jonathan Wakely Date: Mon May 7 20:46:21 2018 +0100 PR libstdc++/85672 #undef _GLIBCXX_USE_FLOAT128 when not supported Restore the behaviour in GCC 8 and earlier where _GLIBCXX_USE_FLOAT128 is not defined when configure detects support is missing. This avoids having three states where the macro is either 1, 0, or undefined. PR libstdc++/85672 * include/Makefile.am [!ENABLE_FLOAT128]: Change c++config.h entry to #undef _GLIBCXX_USE_FLOAT128 instead of defining it to zero. * include/Makefile.in: Regenerate. * include/bits/c++config (_GLIBCXX_USE_FLOAT128): Move definition within conditional block. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index ba5adda95bd..77e6dc2f6be 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -1232,10 +1232,10 @@ endif if ENABLE_FLOAT128 stamp-float128: - echo 1 > stamp-float128 + echo 'define _GLIBCXX_USE_FLOAT128 1' > stamp-float128 else stamp-float128: - echo 0 > stamp-float128 + echo 'undef _GLIBCXX_USE_FLOAT128' > stamp-float128 endif # NB: The non-empty default ldbl_compat works around an AIX sed @@ -1272,7 +1272,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \ -e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \ -e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \ - -e "s,define _GLIBCXX_USE_FLOAT128, define _GLIBCXX_USE_FLOAT128 $$float128," \ + -e "s,define _GLIBCXX_USE_FLOAT128,$$float128," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index e34524117d6..bfe268da825 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -610,9 +610,8 @@ namespace std #endif /* Define if __float128 is supported on this host. */ +#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) #define _GLIBCXX_USE_FLOAT128 -#if !defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__) -#undef _GLIBCXX_USE_FLOAT128 #endif // End of prewritten config; the settings discovered at configure time follow. --YIwHDYD8sUXtBKvt--