diff options
author | Richard Biener <rguenther@suse.de> | 2023-04-19 09:45:55 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-04-19 14:24:10 +0200 |
commit | 210617b53eee01d0a19117f886f5cf7717aa2319 (patch) | |
tree | 4d94933d5fac35d629b6f6e538334953617746bc /gcc/system.h | |
parent | fac24d43e68838c63bfe112c8fb63aa3df960429 (diff) | |
download | gcc-210617b53eee01d0a19117f886f5cf7717aa2319.zip gcc-210617b53eee01d0a19117f886f5cf7717aa2319.tar.gz gcc-210617b53eee01d0a19117f886f5cf7717aa2319.tar.bz2 |
Transform more gmp/mpfr uses to use RAII
The following picks up the coccinelle generated patch from Bernhard,
leaving out the fortran frontend parts and fixing up the rest.
In particular both gmp.h and mpfr.h contain macros like
#define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
for which I add operator-> overloads to the auto_* classes.
* system.h (auto_mpz::operator->()): New.
* realmpfr.h (auto_mpfr::operator->()): New.
* builtins.cc (do_mpfr_lgamma_r): Use auto_mpfr.
* real.cc (real_from_string): Likewise.
(dconst_e_ptr): Likewise.
(dconst_sqrt2_ptr): Likewise.
* tree-ssa-loop-niter.cc (refine_value_range_using_guard):
Use auto_mpz.
(bound_difference_of_offsetted_base): Likewise.
(number_of_iterations_ne): Likewise.
(number_of_iterations_lt_to_ne): Likewise.
* ubsan.cc: Include realmpfr.h.
(ubsan_instrument_float_cast): Use auto_mpfr.
Diffstat (limited to 'gcc/system.h')
-rw-r--r-- | gcc/system.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h index 65d514d..c67bc42 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -709,6 +709,7 @@ public: ~auto_mpz () { mpz_clear (m_mpz); } operator mpz_t& () { return m_mpz; } + mpz_ptr operator-> () { return m_mpz; } auto_mpz (const auto_mpz &) = delete; auto_mpz &operator= (const auto_mpz &) = delete; |