Commit 2f195832 by Ian Lance Taylor

compiler: cleanups permitted by GCC requirement of MPFR 3.1.0

For MPFR functions, change from GMP_RND* to MPFR_RND*.
Also change mp_exp_t to mpfr_expt_t.

Fixes PR go/92463

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/216417
parent 8f25c39c
197381c6364431a7a05e32df683874b7cadcc4b4 132e0e61d59aaa52f8fdb03a925300c1ced2a0f2
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -2580,11 +2580,11 @@ Integer_expression::do_import(Import_expression* imp, Location loc) ...@@ -2580,11 +2580,11 @@ Integer_expression::do_import(Import_expression* imp, Location loc)
return Expression::make_error(loc); return Expression::make_error(loc);
} }
if (pos == std::string::npos) if (pos == std::string::npos)
mpfr_set_ui(real, 0, GMP_RNDN); mpfr_set_ui(real, 0, MPFR_RNDN);
else else
{ {
std::string real_str = num.substr(0, pos); std::string real_str = num.substr(0, pos);
if (mpfr_init_set_str(real, real_str.c_str(), 10, GMP_RNDN) != 0) if (mpfr_init_set_str(real, real_str.c_str(), 10, MPFR_RNDN) != 0)
{ {
go_error_at(imp->location(), "bad number in import data: %qs", go_error_at(imp->location(), "bad number in import data: %qs",
real_str.c_str()); real_str.c_str());
...@@ -2599,7 +2599,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc) ...@@ -2599,7 +2599,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc)
imag_str = num.substr(pos); imag_str = num.substr(pos);
imag_str = imag_str.substr(0, imag_str.size() - 1); imag_str = imag_str.substr(0, imag_str.size() - 1);
mpfr_t imag; mpfr_t imag;
if (mpfr_init_set_str(imag, imag_str.c_str(), 10, GMP_RNDN) != 0) if (mpfr_init_set_str(imag, imag_str.c_str(), 10, MPFR_RNDN) != 0)
{ {
go_error_at(imp->location(), "bad number in import data: %qs", go_error_at(imp->location(), "bad number in import data: %qs",
imag_str.c_str()); imag_str.c_str());
...@@ -2639,7 +2639,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc) ...@@ -2639,7 +2639,7 @@ Integer_expression::do_import(Import_expression* imp, Location loc)
else else
{ {
mpfr_t val; mpfr_t val;
if (mpfr_init_set_str(val, num.c_str(), 10, GMP_RNDN) != 0) if (mpfr_init_set_str(val, num.c_str(), 10, MPFR_RNDN) != 0)
{ {
go_error_at(imp->location(), "bad number in import data: %qs", go_error_at(imp->location(), "bad number in import data: %qs",
num.c_str()); num.c_str());
...@@ -2753,7 +2753,7 @@ class Float_expression : public Expression ...@@ -2753,7 +2753,7 @@ class Float_expression : public Expression
: Expression(EXPRESSION_FLOAT, location), : Expression(EXPRESSION_FLOAT, location),
type_(type) type_(type)
{ {
mpfr_init_set(this->val_, *val, GMP_RNDN); mpfr_init_set(this->val_, *val, MPFR_RNDN);
} }
// Write VAL to export data. // Write VAL to export data.
...@@ -2923,8 +2923,8 @@ Float_expression::do_get_backend(Translate_context* context) ...@@ -2923,8 +2923,8 @@ Float_expression::do_get_backend(Translate_context* context)
void void
Float_expression::export_float(String_dump *exp, const mpfr_t val) Float_expression::export_float(String_dump *exp, const mpfr_t val)
{ {
mp_exp_t exponent; mpfr_exp_t exponent;
char* s = mpfr_get_str(NULL, &exponent, 10, 0, val, GMP_RNDN); char* s = mpfr_get_str(NULL, &exponent, 10, 0, val, MPFR_RNDN);
if (*s == '-') if (*s == '-')
exp->write_c_string("-"); exp->write_c_string("-");
exp->write_c_string("0."); exp->write_c_string("0.");
...@@ -4781,7 +4781,7 @@ Unary_expression::eval_constant(Operator op, const Numeric_constant* unc, ...@@ -4781,7 +4781,7 @@ Unary_expression::eval_constant(Operator op, const Numeric_constant* unc,
unc->get_float(&uval); unc->get_float(&uval);
mpfr_t val; mpfr_t val;
mpfr_init(val); mpfr_init(val);
mpfr_neg(val, uval, GMP_RNDN); mpfr_neg(val, uval, MPFR_RNDN);
nc->set_float(unc->type(), val); nc->set_float(unc->type(), val);
mpfr_clear(uval); mpfr_clear(uval);
mpfr_clear(val); mpfr_clear(val);
...@@ -5613,8 +5613,8 @@ Binary_expression::compare_float(const Numeric_constant* left_nc, ...@@ -5613,8 +5613,8 @@ Binary_expression::compare_float(const Numeric_constant* left_nc,
if (!type->is_abstract() && type->float_type() != NULL) if (!type->is_abstract() && type->float_type() != NULL)
{ {
int bits = type->float_type()->bits(); int bits = type->float_type()->bits();
mpfr_prec_round(left_val, bits, GMP_RNDN); mpfr_prec_round(left_val, bits, MPFR_RNDN);
mpfr_prec_round(right_val, bits, GMP_RNDN); mpfr_prec_round(right_val, bits, MPFR_RNDN);
} }
*cmp = mpfr_cmp(left_val, right_val); *cmp = mpfr_cmp(left_val, right_val);
...@@ -5649,10 +5649,10 @@ Binary_expression::compare_complex(const Numeric_constant* left_nc, ...@@ -5649,10 +5649,10 @@ Binary_expression::compare_complex(const Numeric_constant* left_nc,
if (!type->is_abstract() && type->complex_type() != NULL) if (!type->is_abstract() && type->complex_type() != NULL)
{ {
int bits = type->complex_type()->bits(); int bits = type->complex_type()->bits();
mpfr_prec_round(mpc_realref(left_val), bits / 2, GMP_RNDN); mpfr_prec_round(mpc_realref(left_val), bits / 2, MPFR_RNDN);
mpfr_prec_round(mpc_imagref(left_val), bits / 2, GMP_RNDN); mpfr_prec_round(mpc_imagref(left_val), bits / 2, MPFR_RNDN);
mpfr_prec_round(mpc_realref(right_val), bits / 2, GMP_RNDN); mpfr_prec_round(mpc_realref(right_val), bits / 2, MPFR_RNDN);
mpfr_prec_round(mpc_imagref(right_val), bits / 2, GMP_RNDN); mpfr_prec_round(mpc_imagref(right_val), bits / 2, MPFR_RNDN);
} }
*cmp = mpc_cmp(left_val, right_val) != 0; *cmp = mpc_cmp(left_val, right_val) != 0;
...@@ -5899,10 +5899,10 @@ Binary_expression::eval_float(Operator op, const Numeric_constant* left_nc, ...@@ -5899,10 +5899,10 @@ Binary_expression::eval_float(Operator op, const Numeric_constant* left_nc,
switch (op) switch (op)
{ {
case OPERATOR_PLUS: case OPERATOR_PLUS:
mpfr_add(val, left_val, right_val, GMP_RNDN); mpfr_add(val, left_val, right_val, MPFR_RNDN);
break; break;
case OPERATOR_MINUS: case OPERATOR_MINUS:
mpfr_sub(val, left_val, right_val, GMP_RNDN); mpfr_sub(val, left_val, right_val, MPFR_RNDN);
break; break;
case OPERATOR_OR: case OPERATOR_OR:
case OPERATOR_XOR: case OPERATOR_XOR:
...@@ -5911,20 +5911,20 @@ Binary_expression::eval_float(Operator op, const Numeric_constant* left_nc, ...@@ -5911,20 +5911,20 @@ Binary_expression::eval_float(Operator op, const Numeric_constant* left_nc,
case OPERATOR_MOD: case OPERATOR_MOD:
case OPERATOR_LSHIFT: case OPERATOR_LSHIFT:
case OPERATOR_RSHIFT: case OPERATOR_RSHIFT:
mpfr_set_ui(val, 0, GMP_RNDN); mpfr_set_ui(val, 0, MPFR_RNDN);
ret = false; ret = false;
break; break;
case OPERATOR_MULT: case OPERATOR_MULT:
mpfr_mul(val, left_val, right_val, GMP_RNDN); mpfr_mul(val, left_val, right_val, MPFR_RNDN);
break; break;
case OPERATOR_DIV: case OPERATOR_DIV:
if (!mpfr_zero_p(right_val)) if (!mpfr_zero_p(right_val))
mpfr_div(val, left_val, right_val, GMP_RNDN); mpfr_div(val, left_val, right_val, MPFR_RNDN);
else else
{ {
go_error_at(location, "division by zero"); go_error_at(location, "division by zero");
nc->set_invalid(); nc->set_invalid();
mpfr_set_ui(val, 0, GMP_RNDN); mpfr_set_ui(val, 0, MPFR_RNDN);
} }
break; break;
default: default:
...@@ -18868,7 +18868,7 @@ Numeric_constant::Numeric_constant(const Numeric_constant& a) ...@@ -18868,7 +18868,7 @@ Numeric_constant::Numeric_constant(const Numeric_constant& a)
mpz_init_set(this->u_.int_val, a.u_.int_val); mpz_init_set(this->u_.int_val, a.u_.int_val);
break; break;
case NC_FLOAT: case NC_FLOAT:
mpfr_init_set(this->u_.float_val, a.u_.float_val, GMP_RNDN); mpfr_init_set(this->u_.float_val, a.u_.float_val, MPFR_RNDN);
break; break;
case NC_COMPLEX: case NC_COMPLEX:
mpc_init2(this->u_.complex_val, mpc_precision); mpc_init2(this->u_.complex_val, mpc_precision);
...@@ -18896,7 +18896,7 @@ Numeric_constant::operator=(const Numeric_constant& a) ...@@ -18896,7 +18896,7 @@ Numeric_constant::operator=(const Numeric_constant& a)
mpz_init_set(this->u_.int_val, a.u_.int_val); mpz_init_set(this->u_.int_val, a.u_.int_val);
break; break;
case NC_FLOAT: case NC_FLOAT:
mpfr_init_set(this->u_.float_val, a.u_.float_val, GMP_RNDN); mpfr_init_set(this->u_.float_val, a.u_.float_val, MPFR_RNDN);
break; break;
case NC_COMPLEX: case NC_COMPLEX:
mpc_init2(this->u_.complex_val, mpc_precision); mpc_init2(this->u_.complex_val, mpc_precision);
...@@ -19014,9 +19014,9 @@ Numeric_constant::set_float(Type* type, const mpfr_t val) ...@@ -19014,9 +19014,9 @@ Numeric_constant::set_float(Type* type, const mpfr_t val)
&& !type->float_type()->is_abstract()) && !type->float_type()->is_abstract())
bits = type->float_type()->bits(); bits = type->float_type()->bits();
if (Numeric_constant::is_float_neg_zero(val, bits)) if (Numeric_constant::is_float_neg_zero(val, bits))
mpfr_init_set_ui(this->u_.float_val, 0, GMP_RNDN); mpfr_init_set_ui(this->u_.float_val, 0, MPFR_RNDN);
else else
mpfr_init_set(this->u_.float_val, val, GMP_RNDN); mpfr_init_set(this->u_.float_val, val, MPFR_RNDN);
} }
// Set to a complex value. // Set to a complex value.
...@@ -19036,14 +19036,14 @@ Numeric_constant::set_complex(Type* type, const mpc_t val) ...@@ -19036,14 +19036,14 @@ Numeric_constant::set_complex(Type* type, const mpc_t val)
bits = type->complex_type()->bits() / 2; bits = type->complex_type()->bits() / 2;
mpfr_t real; mpfr_t real;
mpfr_init_set(real, mpc_realref(val), GMP_RNDN); mpfr_init_set(real, mpc_realref(val), MPFR_RNDN);
if (Numeric_constant::is_float_neg_zero(real, bits)) if (Numeric_constant::is_float_neg_zero(real, bits))
mpfr_set_ui(real, 0, GMP_RNDN); mpfr_set_ui(real, 0, MPFR_RNDN);
mpfr_t imag; mpfr_t imag;
mpfr_init_set(imag, mpc_imagref(val), GMP_RNDN); mpfr_init_set(imag, mpc_imagref(val), MPFR_RNDN);
if (Numeric_constant::is_float_neg_zero(imag, bits)) if (Numeric_constant::is_float_neg_zero(imag, bits))
mpfr_set_ui(imag, 0, GMP_RNDN); mpfr_set_ui(imag, 0, MPFR_RNDN);
mpc_init2(this->u_.complex_val, mpc_precision); mpc_init2(this->u_.complex_val, mpc_precision);
mpc_set_fr_fr(this->u_.complex_val, real, imag, MPC_RNDNN); mpc_set_fr_fr(this->u_.complex_val, real, imag, MPC_RNDNN);
...@@ -19062,7 +19062,7 @@ Numeric_constant::is_float_neg_zero(const mpfr_t val, int bits) ...@@ -19062,7 +19062,7 @@ Numeric_constant::is_float_neg_zero(const mpfr_t val, int bits)
return false; return false;
if (mpfr_zero_p(val)) if (mpfr_zero_p(val))
return true; return true;
mp_exp_t min_exp; mpfr_exp_t min_exp;
switch (bits) switch (bits)
{ {
case 0: case 0:
...@@ -19107,7 +19107,7 @@ void ...@@ -19107,7 +19107,7 @@ void
Numeric_constant::get_float(mpfr_t* val) const Numeric_constant::get_float(mpfr_t* val) const
{ {
go_assert(this->is_float()); go_assert(this->is_float());
mpfr_init_set(*val, this->u_.float_val, GMP_RNDN); mpfr_init_set(*val, this->u_.float_val, MPFR_RNDN);
} }
// Get a complex value. // Get a complex value.
...@@ -19167,7 +19167,7 @@ Numeric_constant::mpfr_to_unsigned_long(const mpfr_t fval, ...@@ -19167,7 +19167,7 @@ Numeric_constant::mpfr_to_unsigned_long(const mpfr_t fval,
return NC_UL_NOTINT; return NC_UL_NOTINT;
mpz_t ival; mpz_t ival;
mpz_init(ival); mpz_init(ival);
mpfr_get_z(ival, fval, GMP_RNDN); mpfr_get_z(ival, fval, MPFR_RNDN);
To_unsigned_long ret = this->mpz_to_unsigned_long(ival, val); To_unsigned_long ret = this->mpz_to_unsigned_long(ival, val);
mpz_clear(ival); mpz_clear(ival);
return ret; return ret;
...@@ -19234,7 +19234,7 @@ Numeric_constant::mpfr_to_memory_size(const mpfr_t fval, int64_t* val) const ...@@ -19234,7 +19234,7 @@ Numeric_constant::mpfr_to_memory_size(const mpfr_t fval, int64_t* val) const
return false; return false;
mpz_t ival; mpz_t ival;
mpz_init(ival); mpz_init(ival);
mpfr_get_z(ival, fval, GMP_RNDN); mpfr_get_z(ival, fval, MPFR_RNDN);
bool ret = this->mpz_to_memory_size(ival, val); bool ret = this->mpz_to_memory_size(ival, val);
mpz_clear(ival); mpz_clear(ival);
return ret; return ret;
...@@ -19255,14 +19255,14 @@ Numeric_constant::to_int(mpz_t* val) const ...@@ -19255,14 +19255,14 @@ Numeric_constant::to_int(mpz_t* val) const
if (!mpfr_integer_p(this->u_.float_val)) if (!mpfr_integer_p(this->u_.float_val))
return false; return false;
mpz_init(*val); mpz_init(*val);
mpfr_get_z(*val, this->u_.float_val, GMP_RNDN); mpfr_get_z(*val, this->u_.float_val, MPFR_RNDN);
return true; return true;
case NC_COMPLEX: case NC_COMPLEX:
if (!mpfr_zero_p(mpc_imagref(this->u_.complex_val)) if (!mpfr_zero_p(mpc_imagref(this->u_.complex_val))
|| !mpfr_integer_p(mpc_realref(this->u_.complex_val))) || !mpfr_integer_p(mpc_realref(this->u_.complex_val)))
return false; return false;
mpz_init(*val); mpz_init(*val);
mpfr_get_z(*val, mpc_realref(this->u_.complex_val), GMP_RNDN); mpfr_get_z(*val, mpc_realref(this->u_.complex_val), MPFR_RNDN);
return true; return true;
default: default:
go_unreachable(); go_unreachable();
...@@ -19278,15 +19278,15 @@ Numeric_constant::to_float(mpfr_t* val) const ...@@ -19278,15 +19278,15 @@ Numeric_constant::to_float(mpfr_t* val) const
{ {
case NC_INT: case NC_INT:
case NC_RUNE: case NC_RUNE:
mpfr_init_set_z(*val, this->u_.int_val, GMP_RNDN); mpfr_init_set_z(*val, this->u_.int_val, MPFR_RNDN);
return true; return true;
case NC_FLOAT: case NC_FLOAT:
mpfr_init_set(*val, this->u_.float_val, GMP_RNDN); mpfr_init_set(*val, this->u_.float_val, MPFR_RNDN);
return true; return true;
case NC_COMPLEX: case NC_COMPLEX:
if (!mpfr_zero_p(mpc_imagref(this->u_.complex_val))) if (!mpfr_zero_p(mpc_imagref(this->u_.complex_val)))
return false; return false;
mpfr_init_set(*val, mpc_realref(this->u_.complex_val), GMP_RNDN); mpfr_init_set(*val, mpc_realref(this->u_.complex_val), MPFR_RNDN);
return true; return true;
default: default:
go_unreachable(); go_unreachable();
...@@ -19391,7 +19391,7 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error, ...@@ -19391,7 +19391,7 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error,
return false; return false;
} }
mpz_init(val); mpz_init(val);
mpfr_get_z(val, this->u_.float_val, GMP_RNDN); mpfr_get_z(val, this->u_.float_val, MPFR_RNDN);
break; break;
case NC_COMPLEX: case NC_COMPLEX:
...@@ -19406,7 +19406,7 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error, ...@@ -19406,7 +19406,7 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error,
return false; return false;
} }
mpz_init(val); mpz_init(val);
mpfr_get_z(val, mpc_realref(this->u_.complex_val), GMP_RNDN); mpfr_get_z(val, mpc_realref(this->u_.complex_val), MPFR_RNDN);
break; break;
default: default:
...@@ -19460,11 +19460,11 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, ...@@ -19460,11 +19460,11 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error,
{ {
case NC_INT: case NC_INT:
case NC_RUNE: case NC_RUNE:
mpfr_init_set_z(val, this->u_.int_val, GMP_RNDN); mpfr_init_set_z(val, this->u_.int_val, MPFR_RNDN);
break; break;
case NC_FLOAT: case NC_FLOAT:
mpfr_init_set(val, this->u_.float_val, GMP_RNDN); mpfr_init_set(val, this->u_.float_val, MPFR_RNDN);
break; break;
case NC_COMPLEX: case NC_COMPLEX:
...@@ -19478,7 +19478,7 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, ...@@ -19478,7 +19478,7 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error,
} }
return false; return false;
} }
mpfr_init_set(val, mpc_realref(this->u_.complex_val), GMP_RNDN); mpfr_init_set(val, mpc_realref(this->u_.complex_val), MPFR_RNDN);
break; break;
default: default:
...@@ -19495,8 +19495,8 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, ...@@ -19495,8 +19495,8 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error,
} }
else else
{ {
mp_exp_t exp = mpfr_get_exp(val); mpfr_exp_t exp = mpfr_get_exp(val);
mp_exp_t max_exp; mpfr_exp_t max_exp;
switch (type->bits()) switch (type->bits())
{ {
case 32: case 32:
...@@ -19527,8 +19527,8 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, ...@@ -19527,8 +19527,8 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error,
default: default:
go_unreachable(); go_unreachable();
} }
mpfr_set(t, val, GMP_RNDN); mpfr_set(t, val, MPFR_RNDN);
mpfr_set(val, t, GMP_RNDN); mpfr_set(val, t, MPFR_RNDN);
mpfr_clear(t); mpfr_clear(t);
this->set_float(type, val); this->set_float(type, val);
...@@ -19555,7 +19555,7 @@ Numeric_constant::check_complex_type(Complex_type* type, bool issue_error, ...@@ -19555,7 +19555,7 @@ Numeric_constant::check_complex_type(Complex_type* type, bool issue_error,
if (type->is_abstract()) if (type->is_abstract())
return true; return true;
mp_exp_t max_exp; mpfr_exp_t max_exp;
switch (type->bits()) switch (type->bits())
{ {
case 64: case 64:
...@@ -19687,12 +19687,12 @@ Numeric_constant::hash(unsigned int seed) const ...@@ -19687,12 +19687,12 @@ Numeric_constant::hash(unsigned int seed) const
break; break;
case NC_COMPLEX: case NC_COMPLEX:
mpfr_init(m); mpfr_init(m);
mpc_abs(m, this->u_.complex_val, GMP_RNDN); mpc_abs(m, this->u_.complex_val, MPFR_RNDN);
val = mpfr_get_ui(m, GMP_RNDN); val = mpfr_get_ui(m, MPFR_RNDN);
mpfr_clear(m); mpfr_clear(m);
break; break;
case NC_FLOAT: case NC_FLOAT:
f = mpfr_get_d_2exp(&e, this->u_.float_val, GMP_RNDN) * 4294967295.0; f = mpfr_get_d_2exp(&e, this->u_.float_val, MPFR_RNDN) * 4294967295.0;
val = static_cast<unsigned long>(e + static_cast<long>(f)); val = static_cast<unsigned long>(e + static_cast<long>(f));
break; break;
default: default:
......
...@@ -198,7 +198,7 @@ Token::Token(const Token& tok) ...@@ -198,7 +198,7 @@ Token::Token(const Token& tok)
break; break;
case TOKEN_FLOAT: case TOKEN_FLOAT:
case TOKEN_IMAGINARY: case TOKEN_IMAGINARY:
mpfr_init_set(this->u_.float_value, tok.u_.float_value, GMP_RNDN); mpfr_init_set(this->u_.float_value, tok.u_.float_value, MPFR_RNDN);
break; break;
default: default:
go_unreachable(); go_unreachable();
...@@ -238,7 +238,7 @@ Token::operator=(const Token& tok) ...@@ -238,7 +238,7 @@ Token::operator=(const Token& tok)
break; break;
case TOKEN_FLOAT: case TOKEN_FLOAT:
case TOKEN_IMAGINARY: case TOKEN_IMAGINARY:
mpfr_init_set(this->u_.float_value, tok.u_.float_value, GMP_RNDN); mpfr_init_set(this->u_.float_value, tok.u_.float_value, MPFR_RNDN);
break; break;
default: default:
go_unreachable(); go_unreachable();
...@@ -278,11 +278,11 @@ Token::print(FILE* file) const ...@@ -278,11 +278,11 @@ Token::print(FILE* file) const
break; break;
case TOKEN_FLOAT: case TOKEN_FLOAT:
fprintf(file, "float "); fprintf(file, "float ");
mpfr_out_str(file, 10, 0, this->u_.float_value, GMP_RNDN); mpfr_out_str(file, 10, 0, this->u_.float_value, MPFR_RNDN);
break; break;
case TOKEN_IMAGINARY: case TOKEN_IMAGINARY:
fprintf(file, "imaginary "); fprintf(file, "imaginary ");
mpfr_out_str(file, 10, 0, this->u_.float_value, GMP_RNDN); mpfr_out_str(file, 10, 0, this->u_.float_value, MPFR_RNDN);
break; break;
case TOKEN_OPERATOR: case TOKEN_OPERATOR:
fprintf(file, "operator "); fprintf(file, "operator ");
...@@ -1213,7 +1213,7 @@ Lex::gather_number() ...@@ -1213,7 +1213,7 @@ Lex::gather_number()
else else
{ {
mpfr_t ival; mpfr_t ival;
mpfr_init_set_z(ival, val, GMP_RNDN); mpfr_init_set_z(ival, val, MPFR_RNDN);
mpz_clear(val); mpz_clear(val);
Token ret = Token::make_imaginary_token(ival, location); Token ret = Token::make_imaginary_token(ival, location);
mpfr_clear(ival); mpfr_clear(ival);
...@@ -1310,7 +1310,7 @@ Lex::gather_number() ...@@ -1310,7 +1310,7 @@ Lex::gather_number()
} }
mpfr_t val; mpfr_t val;
int r = mpfr_init_set_str(val, num.c_str(), base, GMP_RNDN); int r = mpfr_init_set_str(val, num.c_str(), base, MPFR_RNDN);
go_assert(r == 0); go_assert(r == 0);
bool is_imaginary = *p == 'i'; bool is_imaginary = *p == 'i';
......
...@@ -2651,7 +2651,7 @@ Parse::operand(bool may_be_sink, bool* is_parenthesized) ...@@ -2651,7 +2651,7 @@ Parse::operand(bool may_be_sink, bool* is_parenthesized)
case Token::TOKEN_IMAGINARY: case Token::TOKEN_IMAGINARY:
{ {
mpfr_t zero; mpfr_t zero;
mpfr_init_set_ui(zero, 0, GMP_RNDN); mpfr_init_set_ui(zero, 0, MPFR_RNDN);
mpc_t val; mpc_t val;
mpc_init2(val, mpc_precision); mpc_init2(val, mpc_precision);
mpc_set_fr_fr(val, zero, *token->imaginary_value(), MPC_RNDNN); mpc_set_fr_fr(val, zero, *token->imaginary_value(), MPC_RNDNN);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment