From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id BC28C3858C74; Sat, 22 Apr 2023 18:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC28C3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682187284; bh=i9u7rX/vWkwlOOpGjTUk9f/biwy7ISG+VChlrz7Bq60=; h=From:To:Subject:Date:From; b=tTt37TR7nDhkQZbs8/3I71nYehKpWjdWX3GqAH2Iwoctj2ZFcllqM+6NhLuwzrf3I t3wOPGpMJ1Upz0nsTQSVRYyK+ESCoRVoBLQ/68p34qka0n1VLFJdxGKvwR6+TyvH7n KSvy+afKktSf3Hy+MDOGt3NkaYZj42zLe08D17Yo= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-165] Fix up bootstrap with GCC 4.[89] after RAII auto_mpfr and autp_mpz [PR109589] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 00c49869fed445bf0f70cfa06b9bae1e75a393c8 X-Git-Newrev: 195270d28a534cc1f08478c6e0136f4fc13d247a Message-Id: <20230422181444.BC28C3858C74@sourceware.org> Date: Sat, 22 Apr 2023 18:14:44 +0000 (GMT) List-Id: https://gcc.gnu.org/g:195270d28a534cc1f08478c6e0136f4fc13d247a commit r14-165-g195270d28a534cc1f08478c6e0136f4fc13d247a Author: Jakub Jelinek Date: Sat Apr 22 20:14:06 2023 +0200 Fix up bootstrap with GCC 4.[89] after RAII auto_mpfr and autp_mpz [PR109589] On Tue, Apr 18, 2023 at 03:39:41PM +0200, Richard Biener via Gcc-patches wrote: > The following adds two RAII classes, one for mpz_t and one for mpfr_t > making object lifetime management easier. Both formerly require > explicit initialization with {mpz,mpfr}_init and release with > {mpz,mpfr}_clear. This unfortunately broke bootstrap when using GCC 4.8.x or 4.9.x as it uses deleted friends which weren't supported until PR62101 fixed them in 2014 for GCC 5. The following patch adds an workaround, not deleting those friends for those old versions. While it means if people add those mp*_{init{,2},clear} calls on auto_mp* objects they won't notice when doing non-bootstrap builds using very old system compilers, people should be bootstrapping their changes and it will be caught during bootstraps even when starting with those old compilers, plus most people actually use much newer compilers when developing. 2023-04-22 Jakub Jelinek PR bootstrap/109589 * system.h (class auto_mpz): Workaround PR62101 bug in GCC 4.8 and 4.9. * realmpfr.h (class auto_mpfr): Likewise. Diff: --- gcc/realmpfr.h | 3 +++ gcc/system.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h index a2b1bf6a2db..c14baa2c1b5 100644 --- a/gcc/realmpfr.h +++ b/gcc/realmpfr.h @@ -37,9 +37,12 @@ public: auto_mpfr (const auto_mpfr &) = delete; auto_mpfr &operator= (const auto_mpfr &) = delete; +#if GCC_VERSION < 4008 || GCC_VERSION >= 5000 + /* GCC 4.8 and 4.9 don't support this, only fixed in PR62101 for 5.0. */ friend void mpfr_clear (auto_mpfr&) = delete; friend void mpfr_init (auto_mpfr&) = delete; friend void mpfr_init2 (auto_mpfr&, mpfr_prec_t) = delete; +#endif private: mpfr_t m_mpfr; diff --git a/gcc/system.h b/gcc/system.h index c67bc42863f..5109c60c600 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -714,8 +714,11 @@ public: auto_mpz (const auto_mpz &) = delete; auto_mpz &operator= (const auto_mpz &) = delete; +#if GCC_VERSION < 4008 || GCC_VERSION >= 5000 + /* GCC 4.8 and 4.9 don't support this, only fixed in PR62101 for 5.0. */ friend void mpz_clear (auto_mpz&) = delete; friend void mpz_init (auto_mpz&) = delete; +#endif private: mpz_t m_mpz;