+2004-08-27 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * gfortran.h (gfc_default_*_kind): Remove prototypes, add extern
+ variable declaration of same name.
+ * arith.c, check.c, decl.c, dump_parse_tree.c, expr.c,
+ intrinsic.c, io.c, iresolve.c, match.c, options.c, primary.c,
+ resolve.c, simplify.c, symbol.c, trans-const.c, trans-io.c:
+ Replace all calls to gfc_default_*_kind with variable accesses.
+ * trans-types.c: Same as above.
+ (gfc_default_*_kind_1): Rename to gfc_default_*_kind, remove
+ static qualifier. Replace all occurences.
+ (gfc_default_*_kind): Remove functions.
+
2004-08-26 Richard Henderson <rth@redhat.com>
* arith.c: Include system.h, not real system headers.
gfc_expr *result;
int len;
- result = gfc_constant_result (BT_CHARACTER, gfc_default_character_kind (),
+ result = gfc_constant_result (BT_CHARACTER, gfc_default_character_kind,
&op1->where);
len = op1->value.character.length + op2->value.character.length;
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (op1->ts.type == BT_COMPLEX) ?
compare_complex (op1, op2) : (gfc_compare_expr (op1, op2) == 0);
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (op1->ts.type == BT_COMPLEX) ?
!compare_complex (op1, op2) : (gfc_compare_expr (op1, op2) != 0);
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2) > 0);
*resultp = result;
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2) >= 0);
*resultp = result;
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2) < 0);
*resultp = result;
{
gfc_expr *result;
- result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind (),
+ result = gfc_constant_result (BT_LOGICAL, gfc_default_logical_kind,
&op1->where);
result->value.logical = (gfc_compare_expr (op1, op2) <= 0);
*resultp = result;
goto runtime;
temp.ts.type = BT_LOGICAL;
- temp.ts.kind = gfc_default_logical_kind ();
+ temp.ts.kind = gfc_default_logical_kind;
unary = 1;
break;
goto runtime;
temp.ts.type = BT_LOGICAL;
- temp.ts.kind = gfc_default_logical_kind ();
+ temp.ts.kind = gfc_default_logical_kind;
unary = 0;
break;
if (op1->ts.type == BT_COMPLEX || op2->ts.type == BT_COMPLEX)
{
temp.ts.type = BT_LOGICAL;
- temp.ts.kind = gfc_default_logical_kind();
+ temp.ts.kind = gfc_default_logical_kind;
goto runtime;
}
{
unary = 0;
temp.ts.type = BT_LOGICAL;
- temp.ts.kind = gfc_default_logical_kind();
+ temp.ts.kind = gfc_default_logical_kind;
break;
}
|| operator == INTRINSIC_LE || operator == INTRINSIC_LT)
{
temp.ts.type = BT_LOGICAL;
- temp.ts.kind = gfc_default_logical_kind ();
+ temp.ts.kind = gfc_default_logical_kind;
}
unary = 0;
goto runtime;
temp.ts.type = BT_CHARACTER;
- temp.ts.kind = gfc_default_character_kind ();
+ temp.ts.kind = gfc_default_character_kind;
unary = 0;
break;
case INTRINSIC_EQ:
case INTRINSIC_NE:
op->ts.type = BT_LOGICAL;
- op->ts.kind = gfc_default_logical_kind();
+ op->ts.kind = gfc_default_logical_kind;
break;
default:
if (type_check (d, n, BT_REAL) == FAILURE)
return FAILURE;
- if (d->ts.kind != gfc_default_double_kind ())
+ if (d->ts.kind != gfc_default_double_kind)
{
must_be (d, n, "double precision");
return FAILURE;
if (type_check (i, 0, BT_INTEGER) == FAILURE
|| type_check (pos, 1, BT_INTEGER) == FAILURE
- || kind_value_check (pos, 1, gfc_default_integer_kind ()) == FAILURE)
+ || kind_value_check (pos, 1, gfc_default_integer_kind) == FAILURE)
return FAILURE;
return SUCCESS;
if (type_check (i, 0, BT_INTEGER) == FAILURE
|| type_check (pos, 1, BT_INTEGER) == FAILURE
- || kind_value_check (pos, 1, gfc_default_integer_kind ()) == FAILURE
+ || kind_value_check (pos, 1, gfc_default_integer_kind) == FAILURE
|| type_check (len, 2, BT_INTEGER) == FAILURE)
return FAILURE;
if (type_check (i, 0, BT_INTEGER) == FAILURE
|| type_check (pos, 1, BT_INTEGER) == FAILURE
- || kind_value_check (pos, 1, gfc_default_integer_kind ()) == FAILURE)
+ || kind_value_check (pos, 1, gfc_default_integer_kind) == FAILURE)
return FAILURE;
return SUCCESS;
gfc_check_min_max_integer (gfc_actual_arglist * arg)
{
- return check_rest (BT_INTEGER, gfc_default_integer_kind (), arg);
+ return check_rest (BT_INTEGER, gfc_default_integer_kind, arg);
}
gfc_check_min_max_real (gfc_actual_arglist * arg)
{
- return check_rest (BT_REAL, gfc_default_real_kind (), arg);
+ return check_rest (BT_REAL, gfc_default_real_kind, arg);
}
gfc_check_min_max_double (gfc_actual_arglist * arg)
{
- return check_rest (BT_REAL, gfc_default_double_kind (), arg);
+ return check_rest (BT_REAL, gfc_default_double_kind, arg);
}
/* End of min/max family. */
if (type_check (dim, 1, BT_INTEGER) == FAILURE)
return FAILURE;
- if (kind_value_check (dim, 1, gfc_default_integer_kind ()) == FAILURE)
+ if (kind_value_check (dim, 1, gfc_default_integer_kind) == FAILURE)
return FAILURE;
if (dim_rank_check (dim, array, 0) == FAILURE)
if (variable_check (size, 0) == FAILURE)
return FAILURE;
- if (kind_value_check (size, 0, gfc_default_integer_kind ()) == FAILURE)
+ if (kind_value_check (size, 0, gfc_default_integer_kind) == FAILURE)
return FAILURE;
}
if (type_check (put, 1, BT_INTEGER) == FAILURE)
return FAILURE;
- if (kind_value_check (put, 1, gfc_default_integer_kind ()) == FAILURE)
+ if (kind_value_check (put, 1, gfc_default_integer_kind) == FAILURE)
return FAILURE;
}
if (variable_check (get, 2) == FAILURE)
return FAILURE;
- if (kind_value_check (get, 2, gfc_default_integer_kind ()) == FAILURE)
+ if (kind_value_check (get, 2, gfc_default_integer_kind) == FAILURE)
return FAILURE;
}
gfc_expr *len;
match m;
- kind = gfc_default_character_kind ();
+ kind = gfc_default_character_kind;
len = NULL;
seen_length = 0;
if (gfc_match (" integer") == MATCH_YES)
{
ts->type = BT_INTEGER;
- ts->kind = gfc_default_integer_kind ();
+ ts->kind = gfc_default_integer_kind;
goto get_kind;
}
if (gfc_match (" real") == MATCH_YES)
{
ts->type = BT_REAL;
- ts->kind = gfc_default_real_kind ();
+ ts->kind = gfc_default_real_kind;
goto get_kind;
}
if (gfc_match (" double precision") == MATCH_YES)
{
ts->type = BT_REAL;
- ts->kind = gfc_default_double_kind ();
+ ts->kind = gfc_default_double_kind;
return MATCH_YES;
}
if (gfc_match (" complex") == MATCH_YES)
{
ts->type = BT_COMPLEX;
- ts->kind = gfc_default_complex_kind ();
+ ts->kind = gfc_default_complex_kind;
goto get_kind;
}
if (gfc_match (" double complex") == MATCH_YES)
{
ts->type = BT_COMPLEX;
- ts->kind = gfc_default_double_kind ();
+ ts->kind = gfc_default_double_kind;
return MATCH_YES;
}
if (gfc_match (" logical") == MATCH_YES)
{
ts->type = BT_LOGICAL;
- ts->kind = gfc_default_logical_kind ();
+ ts->kind = gfc_default_logical_kind;
goto get_kind;
}
/* Check for CHARACTER with no length parameter. */
if (ts.type == BT_CHARACTER && !ts.cl)
{
- ts.kind = gfc_default_character_kind ();
+ ts.kind = gfc_default_character_kind;
ts.cl = gfc_get_charlen ();
ts.cl->next = gfc_current_ns->cl_list;
gfc_current_ns->cl_list = ts.cl;
case BT_INTEGER:
mpz_out_str (stdout, 10, p->value.integer);
- if (p->ts.kind != gfc_default_integer_kind ())
+ if (p->ts.kind != gfc_default_integer_kind)
gfc_status ("_%d", p->ts.kind);
break;
case BT_REAL:
mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE);
- if (p->ts.kind != gfc_default_real_kind ())
+ if (p->ts.kind != gfc_default_real_kind)
gfc_status ("_%d", p->ts.kind);
break;
gfc_status ("(complex ");
mpfr_out_str (stdout, 10, 0, p->value.complex.r, GFC_RND_MODE);
- if (p->ts.kind != gfc_default_complex_kind ())
+ if (p->ts.kind != gfc_default_complex_kind)
gfc_status ("_%d", p->ts.kind);
gfc_status (" ");
mpfr_out_str (stdout, 10, 0, p->value.complex.i, GFC_RND_MODE);
- if (p->ts.kind != gfc_default_complex_kind ())
+ if (p->ts.kind != gfc_default_complex_kind)
gfc_status ("_%d", p->ts.kind);
gfc_status (")");
p->expr_type = EXPR_CONSTANT;
p->ts.type = BT_INTEGER;
- p->ts.kind = gfc_default_integer_kind ();
+ p->ts.kind = gfc_default_integer_kind;
p->where = gfc_current_locus;
mpz_init_set_si (p->value.integer, i);
p->expr_type = EXPR_CONSTANT;
p->ts.type = BT_LOGICAL;
- p->ts.kind = gfc_default_logical_kind ();
+ p->ts.kind = gfc_default_logical_kind;
if (where == NULL)
where = &gfc_current_locus;
void gfc_arith_done_1 (void);
/* trans-types.c */
-/* FIXME: These should go to symbol.c, really... */
-int gfc_default_integer_kind (void);
-int gfc_default_real_kind (void);
-int gfc_default_double_kind (void);
-int gfc_default_character_kind (void);
-int gfc_default_logical_kind (void);
-int gfc_default_complex_kind (void);
int gfc_validate_kind (bt, int, bool);
extern int gfc_index_integer_kind;
+extern int gfc_default_integer_kind;
+extern int gfc_default_real_kind;
+extern int gfc_default_double_kind;
+extern int gfc_default_character_kind;
+extern int gfc_default_logical_kind;
+extern int gfc_default_complex_kind;
/* symbol.c */
void gfc_clear_new_implicit (void);
int di, dr, dd, dl, dc, dz, ii;
- di = gfc_default_integer_kind ();
- dr = gfc_default_real_kind ();
- dd = gfc_default_double_kind ();
- dl = gfc_default_logical_kind ();
- dc = gfc_default_character_kind ();
- dz = gfc_default_complex_kind ();
+ di = gfc_default_integer_kind;
+ dr = gfc_default_real_kind;
+ dd = gfc_default_double_kind;
+ dl = gfc_default_logical_kind;
+ dc = gfc_default_character_kind;
+ dz = gfc_default_complex_kind;
ii = gfc_index_integer_kind;
add_sym_1 ("abs", 1, 1, BT_REAL, dr,
int di, dr, dc, dl;
- di = gfc_default_integer_kind ();
- dr = gfc_default_real_kind ();
- dc = gfc_default_character_kind ();
- dl = gfc_default_logical_kind ();
+ di = gfc_default_integer_kind;
+ dr = gfc_default_real_kind;
+ dc = gfc_default_character_kind;
+ dl = gfc_default_logical_kind;
add_sym_0s ("abort", 1, NULL);
e = gfc_get_expr();
e->expr_type = EXPR_CONSTANT;
e->ts.type = BT_CHARACTER;
- e->ts.kind = gfc_default_character_kind();
+ e->ts.kind = gfc_default_character_kind;
e->where = start;
e->value.character.string = format_string = gfc_getmem(format_length+1);
e->value.character.length = format_length;
{
f->ts.type = BT_LOGICAL;
- f->ts.kind = gfc_default_logical_kind ();
+ f->ts.kind = gfc_default_logical_kind;
f->value.function.name = gfc_get_string ("__btest_%d_%d", i->ts.kind,
pos->ts.kind);
{
f->ts.type = BT_INTEGER;
- f->ts.kind = (kind == NULL) ? gfc_default_integer_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_integer_kind
: mpz_get_si (kind->value.integer);
f->value.function.name =
{
f->ts.type = BT_CHARACTER;
- f->ts.kind = (kind == NULL) ? gfc_default_character_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_character_kind
: mpz_get_si (kind->value.integer);
f->value.function.name =
{
f->ts.type = BT_COMPLEX;
- f->ts.kind = (kind == NULL) ? gfc_default_real_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_real_kind
: mpz_get_si (kind->value.integer);
if (y == NULL)
void
gfc_resolve_dcmplx (gfc_expr * f, gfc_expr * x, gfc_expr * y)
{
- gfc_resolve_cmplx (f, x, y, gfc_int_expr (gfc_default_double_kind ()));
+ gfc_resolve_cmplx (f, x, y, gfc_int_expr (gfc_default_double_kind));
}
void
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
if (dim != NULL)
{
{
f->ts.type = BT_REAL;
- f->ts.kind = gfc_default_double_kind ();
+ f->ts.kind = gfc_default_double_kind;
f->value.function.name =
gfc_get_string ("__dble_%c%d", gfc_type_letter (a->ts.type), a->ts.kind);
}
if (a->ts.type == BT_LOGICAL && b->ts.type == BT_LOGICAL)
{
f->ts.type = BT_LOGICAL;
- f->ts.kind = gfc_default_logical_kind ();
+ f->ts.kind = gfc_default_logical_kind;
}
else
{
gfc_expr * a ATTRIBUTE_UNUSED,
gfc_expr * b ATTRIBUTE_UNUSED)
{
- f->ts.kind = gfc_default_double_kind ();
+ f->ts.kind = gfc_default_double_kind;
f->ts.type = BT_REAL;
f->value.function.name = gfc_get_string ("__dprod_r%d", f->ts.kind);
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__exponent_%d", x->ts.kind);
}
{
f->ts.type = BT_INTEGER;
- f->ts.kind = (kind == NULL) ? gfc_default_integer_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_integer_kind
: mpz_get_si (kind->value.integer);
f->value.function.name =
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__ichar_%d", c->ts.kind);
}
{
f->ts.type = BT_INTEGER;
- f->ts.kind = (kind == NULL) ? gfc_default_integer_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_integer_kind
: mpz_get_si (kind->value.integer);
f->value.function.name =
{
int s_kind;
- s_kind = (size == NULL) ? gfc_default_integer_kind () : shift->ts.kind;
+ s_kind = (size == NULL) ? gfc_default_integer_kind : shift->ts.kind;
f->ts = i->ts;
f->value.function.name =
static char lbound[] = "__lbound";
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
if (dim == NULL)
{
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__len_%d", string->ts.kind);
}
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__len_trim%d", string->ts.kind);
}
{
f->ts.type = BT_LOGICAL;
- f->ts.kind = (kind == NULL) ? gfc_default_logical_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_logical_kind
: mpz_get_si (kind->value.integer);
f->rank = a->rank;
if (a->ts.type == BT_LOGICAL && b->ts.type == BT_LOGICAL)
{
f->ts.type = BT_LOGICAL;
- f->ts.kind = gfc_default_logical_kind ();
+ f->ts.kind = gfc_default_logical_kind;
}
else
{
const char *name;
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
if (dim == NULL)
f->rank = 1;
const char *name;
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
if (dim == NULL)
f->rank = 1;
{
f->ts.type = BT_INTEGER;
- f->ts.kind = (kind == NULL) ? gfc_default_integer_kind ()
+ f->ts.kind = (kind == NULL) ? gfc_default_integer_kind
: mpz_get_si (kind->value.integer);
f->value.function.name =
f->ts.kind = mpz_get_si (kind->value.integer);
else
f->ts.kind = (a->ts.type == BT_COMPLEX) ?
- a->ts.kind : gfc_default_real_kind ();
+ a->ts.kind : gfc_default_real_kind;
f->value.function.name =
gfc_get_string ("__real_%d_%c%d", f->ts.kind,
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__scan_%d", string->ts.kind);
}
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->rank = 1;
f->value.function.name = gfc_get_string ("__shape_%d", f->ts.kind);
f->shape = gfc_get_shape (1);
static char ubound[] = "__ubound";
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
if (dim == NULL)
{
{
f->ts.type = BT_INTEGER;
- f->ts.kind = gfc_default_integer_kind ();
+ f->ts.kind = gfc_default_integer_kind;
f->value.function.name = gfc_get_string ("__verify_%d", string->ts.kind);
}
const char *name;
int kind;
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
name = gfc_get_string (PREFIX("getarg_i%d"), kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
const char *name;
int kind;
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
name = gfc_get_string (PREFIX("get_command_i%d"), kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
const char *name;
int kind;
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
name = gfc_get_string (PREFIX("get_command_argument_i%d"), kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
const char *name;
int kind;
- kind = gfc_default_integer_kind();
+ kind = gfc_default_integer_kind;
name = gfc_get_string (PREFIX("get_environment_variable_i%d"), kind);
code->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
}
else if (c->ext.actual->next->next->expr != NULL)
kind = c->ext.actual->next->next->expr->ts.kind;
else
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
name = gfc_get_string (PREFIX("system_clock_%d"), kind);
c->resolved_sym = gfc_get_intrinsic_sub_symbol (name);
select_sym = select_st->n.sym;
select_sym->ts.type = BT_INTEGER;
- select_sym->ts.kind = gfc_default_integer_kind ();
+ select_sym->ts.kind = gfc_default_integer_kind;
gfc_set_sym_referenced (select_sym);
c->expr = gfc_get_expr ();
c->expr->expr_type = EXPR_VARIABLE;
gfc_option.flag_pack_derived = 0;
gfc_option.flag_repack_arrays = 0;
- gfc_option.q_kind = gfc_default_double_kind ();
+ gfc_option.q_kind = gfc_default_double_kind;
gfc_option.i8 = 0;
gfc_option.r8 = 0;
gfc_option.d8 = 0;
kind = get_kind ();
if (kind == -2)
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
if (kind == -1)
return MATCH_ERROR;
match_digits (0, radix, buffer);
gfc_next_char ();
- e = gfc_convert_integer (buffer, gfc_default_integer_kind (), radix,
+ e = gfc_convert_integer (buffer, gfc_default_integer_kind, radix,
&gfc_current_locus);
if (gfc_range_check (e) != ARITH_OK)
("Real number at %C has a 'd' exponent and an explicit kind");
goto cleanup;
}
- kind = gfc_default_double_kind ();
+ kind = gfc_default_double_kind;
break;
case 'q':
default:
if (kind == -2)
- kind = gfc_default_real_kind ();
+ kind = gfc_default_real_kind;
if (gfc_validate_kind (BT_REAL, kind, true) < 0)
{
c = gfc_next_char ();
if (c == '\'' || c == '"')
{
- kind = gfc_default_character_kind ();
+ kind = gfc_default_character_kind;
goto got_delim;
}
if (kind == -1)
return MATCH_ERROR;
if (kind == -2)
- kind = gfc_default_logical_kind ();
+ kind = gfc_default_logical_kind;
if (gfc_validate_kind (BT_LOGICAL, kind, true) < 0)
gfc_error ("Bad kind for logical constant at %C");
break;
case BT_INTEGER:
- e = gfc_int2real (sym->value, gfc_default_real_kind ());
+ e = gfc_int2real (sym->value, gfc_default_real_kind);
if (e == NULL)
goto error;
break;
if (seen_dp == 0 && exp_char == ' ')
{
if (kind == -2)
- kind = gfc_default_integer_kind ();
+ kind = gfc_default_integer_kind;
}
else
("Real number at %C has a 'd' exponent and an explicit kind");
return MATCH_ERROR;
}
- kind = gfc_default_double_kind ();
+ kind = gfc_default_double_kind;
}
else
{
if (kind == -2)
- kind = gfc_default_real_kind ();
+ kind = gfc_default_real_kind;
}
if (gfc_validate_kind (BT_REAL, kind, true) < 0)
if (op1->ts.type == BT_CHARACTER && op2->ts.type == BT_CHARACTER)
{
e->ts.type = BT_LOGICAL;
- e->ts.kind = gfc_default_logical_kind ();
+ e->ts.kind = gfc_default_logical_kind;
break;
}
gfc_type_convert_binary (e);
e->ts.type = BT_LOGICAL;
- e->ts.kind = gfc_default_logical_kind ();
+ e->ts.kind = gfc_default_logical_kind;
break;
}
return &gfc_bad_expr;
}
- result = gfc_constant_result (BT_CHARACTER, gfc_default_character_kind (),
+ result = gfc_constant_result (BT_CHARACTER, gfc_default_character_kind,
&e->where);
result->value.character.string = gfc_getmem (2);
mpfr_trunc (rtrunc->value.real, e->value.real);
- result = gfc_real2real (rtrunc, gfc_default_double_kind ());
+ result = gfc_real2real (rtrunc, gfc_default_double_kind);
gfc_free_expr (rtrunc);
return range_check (result, "DINT");
return NULL;
result =
- gfc_constant_result (BT_REAL, gfc_default_double_kind (), &e->where);
+ gfc_constant_result (BT_REAL, gfc_default_double_kind, &e->where);
rtrunc = gfc_copy_expr (e);
cmp = mpfr_cmp_ui (e->value.real, 0);
- gfc_set_model_kind (gfc_default_double_kind ());
+ gfc_set_model_kind (gfc_default_double_kind);
mpfr_init (half);
mpfr_set_str (half, "0.5", 10, GFC_RND_MODE);
gfc_expr *ceil, *result;
int kind;
- kind = get_kind (BT_REAL, k, "CEILING", gfc_default_real_kind ());
+ kind = get_kind (BT_REAL, k, "CEILING", gfc_default_real_kind);
if (kind == -1)
return &gfc_bad_expr;
gfc_expr *result;
int c, kind;
- kind = get_kind (BT_CHARACTER, k, "CHAR", gfc_default_character_kind ());
+ kind = get_kind (BT_CHARACTER, k, "CHAR", gfc_default_character_kind);
if (kind == -1)
return &gfc_bad_expr;
|| (y != NULL && y->expr_type != EXPR_CONSTANT))
return NULL;
- kind = get_kind (BT_REAL, k, "CMPLX", gfc_default_real_kind ());
+ kind = get_kind (BT_REAL, k, "CMPLX", gfc_default_real_kind);
if (kind == -1)
return &gfc_bad_expr;
|| (y != NULL && y->expr_type != EXPR_CONSTANT))
return NULL;
- return simplify_cmplx ("DCMPLX", x, y, gfc_default_double_kind ());
+ return simplify_cmplx ("DCMPLX", x, y, gfc_default_double_kind);
}
switch (e->ts.type)
{
case BT_INTEGER:
- result = gfc_int2real (e, gfc_default_double_kind ());
+ result = gfc_int2real (e, gfc_default_double_kind);
break;
case BT_REAL:
- result = gfc_real2real (e, gfc_default_double_kind ());
+ result = gfc_real2real (e, gfc_default_double_kind);
break;
case BT_COMPLEX:
- result = gfc_complex2real (e, gfc_default_double_kind ());
+ result = gfc_complex2real (e, gfc_default_double_kind);
break;
default:
return NULL;
result =
- gfc_constant_result (BT_REAL, gfc_default_double_kind (), &x->where);
+ gfc_constant_result (BT_REAL, gfc_default_double_kind, &x->where);
- a1 = gfc_real2real (x, gfc_default_double_kind ());
- a2 = gfc_real2real (y, gfc_default_double_kind ());
+ a1 = gfc_real2real (x, gfc_default_double_kind);
+ a2 = gfc_real2real (y, gfc_default_double_kind);
mpfr_mul (result->value.real, a1->value.real, a2->value.real, GFC_RND_MODE);
if (x->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&x->where);
gfc_set_model (x->value.real);
if (a->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_int2real (a, gfc_default_real_kind ());
+ result = gfc_int2real (a, gfc_default_real_kind);
return range_check (result, "FLOAT");
}
mpfr_t floor;
int kind;
- kind = get_kind (BT_REAL, k, "FLOOR", gfc_default_real_kind ());
+ kind = get_kind (BT_REAL, k, "FLOOR", gfc_default_real_kind);
if (kind == -1)
gfc_internal_error ("gfc_simplify_floor(): Bad kind");
else
back = 0;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&x->where);
len = x->value.character.length;
gfc_expr *rpart, *rtrunc, *result;
int kind;
- kind = get_kind (BT_REAL, k, "INT", gfc_default_real_kind ());
+ kind = get_kind (BT_REAL, k, "INT", gfc_default_real_kind);
if (kind == -1)
return &gfc_bad_expr;
if (e->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&e->where);
rtrunc = gfc_copy_expr (e);
if (e->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&e->where);
rtrunc = gfc_copy_expr (e);
if (e->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&e->where);
mpz_set_si (result->value.integer, e->value.character.length);
if (e->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&e->where);
len = e->value.character.length;
gfc_expr *result;
int kind;
- kind = get_kind (BT_LOGICAL, k, "LOGICAL", gfc_default_logical_kind ());
+ kind = get_kind (BT_LOGICAL, k, "LOGICAL", gfc_default_logical_kind);
if (kind < 0)
return &gfc_bad_expr;
int kind, cmp;
mpfr_t half;
- kind = get_kind (BT_INTEGER, k, name, gfc_default_integer_kind ());
+ kind = get_kind (BT_INTEGER, k, name, gfc_default_integer_kind);
if (kind == -1)
return &gfc_bad_expr;
if (e->ts.type == BT_COMPLEX)
kind = get_kind (BT_REAL, k, "REAL", e->ts.kind);
else
- kind = get_kind (BT_REAL, k, "REAL", gfc_default_real_kind ());
+ kind = get_kind (BT_REAL, k, "REAL", gfc_default_real_kind);
if (kind == -1)
return &gfc_bad_expr;
else
back = 0;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&e->where);
len = e->value.character.length;
if (source->rank == 0 || source->expr_type != EXPR_VARIABLE)
return NULL;
- result = gfc_start_constructor (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_start_constructor (BT_INTEGER, gfc_default_integer_kind,
&source->where);
ar = gfc_find_array_ref (source);
for (n = 0; n < source->rank; n++)
{
- e = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ e = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&source->where);
if (t == SUCCESS)
return NULL;
}
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&array->where);
mpz_set (result->value.integer, size);
if (a->expr_type != EXPR_CONSTANT)
return NULL;
- result = gfc_real2real (a, gfc_default_real_kind ());
+ result = gfc_real2real (a, gfc_default_real_kind);
return range_check (result, "SNGL");
}
else
back = 0;
- result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind (),
+ result = gfc_constant_result (BT_INTEGER, gfc_default_integer_kind,
&s->where);
len = s->value.character.length;
if ('i' <= i && i <= 'n')
{
ts->type = BT_INTEGER;
- ts->kind = gfc_default_integer_kind ();
+ ts->kind = gfc_default_integer_kind;
}
else
{
ts->type = BT_REAL;
- ts->kind = gfc_default_real_kind ();
+ ts->kind = gfc_default_real_kind;
}
}
edigits += 3;
}
- if (kind == gfc_default_double_kind())
+ if (kind == gfc_default_double_kind)
p = mpfr_get_str (NULL, &exp, 10, 17, f, GFC_RND_MODE);
else
p = mpfr_get_str (NULL, &exp, 10, 8, f, GFC_RND_MODE);
nml_name = gfc_get_expr();
nml_name->ref = NULL;
nml_name->expr_type = EXPR_CONSTANT;
- nml_name->ts.kind = gfc_default_character_kind ();
+ nml_name->ts.kind = gfc_default_character_kind;
nml_name->ts.type = BT_CHARACTER;
nml_name->value.character.length = strlen(name);
nml_name->value.character.string = name;
/* The default kinds of the various types. */
-static int gfc_default_integer_kind_1;
-static int gfc_default_real_kind_1;
-static int gfc_default_double_kind_1;
-static int gfc_default_character_kind_1;
-static int gfc_default_logical_kind_1;
-static int gfc_default_complex_kind_1;
+int gfc_default_integer_kind;
+int gfc_default_real_kind;
+int gfc_default_double_kind;
+int gfc_default_character_kind;
+int gfc_default_logical_kind;
+int gfc_default_complex_kind;
/* Query the target to determine which machine modes are available for
computation. Choose KIND numbers for them. */
{
if (!saw_i8)
fatal_error ("integer kind=8 not available for -i8 option");
- gfc_default_integer_kind_1 = 8;
+ gfc_default_integer_kind = 8;
}
else if (saw_i4)
- gfc_default_integer_kind_1 = 4;
+ gfc_default_integer_kind = 4;
else
- gfc_default_integer_kind_1 = gfc_integer_kinds[i_index - 1].kind;
+ gfc_default_integer_kind = gfc_integer_kinds[i_index - 1].kind;
/* Choose the default real kind. Again, we choose 4 when possible. */
if (gfc_option.r8)
{
if (!saw_r8)
fatal_error ("real kind=8 not available for -r8 option");
- gfc_default_real_kind_1 = 8;
+ gfc_default_real_kind = 8;
}
else if (saw_r4)
- gfc_default_real_kind_1 = 4;
+ gfc_default_real_kind = 4;
else
- gfc_default_real_kind_1 = gfc_real_kinds[0].kind;
+ gfc_default_real_kind = gfc_real_kinds[0].kind;
/* Choose the default double kind. If -r8 is specified, we use kind=16,
if it's available, otherwise we do not change anything. */
if (gfc_option.r8 && saw_r16)
- gfc_default_double_kind_1 = 16;
+ gfc_default_double_kind = 16;
else if (saw_r4 && saw_r8)
- gfc_default_double_kind_1 = 8;
+ gfc_default_double_kind = 8;
else
{
/* F95 14.6.3.1: A nonpointer scalar object of type double precision
no GCC targets for which a two-word type does not exist, so we
just let gfc_validate_kind abort and tell us if something breaks. */
- gfc_default_double_kind_1
- = gfc_validate_kind (BT_REAL, gfc_default_real_kind_1 * 2, false);
+ gfc_default_double_kind
+ = gfc_validate_kind (BT_REAL, gfc_default_real_kind * 2, false);
}
/* The default logical kind is constrained to be the same as the
default integer kind. Similarly with complex and real. */
- gfc_default_logical_kind_1 = gfc_default_integer_kind_1;
- gfc_default_complex_kind_1 = gfc_default_real_kind_1;
+ gfc_default_logical_kind = gfc_default_integer_kind;
+ gfc_default_complex_kind = gfc_default_real_kind;
/* Choose the smallest integer kind for our default character. */
- gfc_default_character_kind_1 = gfc_integer_kinds[0].kind;
+ gfc_default_character_kind = gfc_integer_kinds[0].kind;
/* Choose the integer kind the same size as "void*" for our index kind. */
gfc_index_integer_kind = POINTER_SIZE / 8;
}
-/* ??? These functions should go away in favor of direct access to
- the relevant variables. */
-
-int
-gfc_default_integer_kind (void)
-{
- return gfc_default_integer_kind_1;
-}
-
-int
-gfc_default_real_kind (void)
-{
- return gfc_default_real_kind_1;
-}
-
-int
-gfc_default_double_kind (void)
-{
- return gfc_default_double_kind_1;
-}
-
-int
-gfc_default_character_kind (void)
-{
- return gfc_default_character_kind_1;
-}
-
-int
-gfc_default_logical_kind (void)
-{
- return gfc_default_logical_kind_1;
-}
-
-int
-gfc_default_complex_kind (void)
-{
- return gfc_default_complex_kind_1;
-}
-
/* Make sure that a valid kind is present. Returns an index into the
associated kinds array, -1 if the kind is not present. */
static int
validate_character (int kind)
{
- return kind == gfc_default_character_kind_1 ? 0 : -1;
+ return kind == gfc_default_character_kind ? 0 : -1;
}
/* Validate a kind given a basic type. The return value is the same
= build_int_cst_wide (long_unsigned_type_node, lo, hi);
size_type_node = gfc_array_index_type;
- boolean_type_node = gfc_get_logical_type (gfc_default_logical_kind ());
+ boolean_type_node = gfc_get_logical_type (gfc_default_logical_kind);
boolean_true_node = build_int_cst (boolean_type_node, 1);
boolean_false_node = build_int_cst (boolean_type_node, 0);