diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-21 10:30:54 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-01-21 10:30:54 +0000 |
commit | dc326dc04b88cc0e2febb5f82cd5f7f9f249e567 (patch) | |
tree | a3c04db8f13bc28886f7a7a7f58defc6d3b7c3be /gcc/fortran/simplify.c | |
parent | a0e066ed2ee771986d92e1076215ade1b6414c4f (diff) | |
download | gcc-dc326dc04b88cc0e2febb5f82cd5f7f9f249e567.tar.gz |
* gfortran.h (gfc_extract_int): Change return type to bool. Add
int argument with = 0.
* decl.c (gfc_match_kind_spec): Adjust gfc_extract_int caller, pass
1 as new last argument to it, don't emit gfc_error.
(match_char_kind): Likewise.
(gfc_match_decl_type_spec): Use gfc_get_string ("%s", x) instead of
gfc_get_string (x).
(gfc_match_derived_decl, match_binding_attributes): Likewise.
(gfc_match_structure_decl): Don't sprintf back to name, call
get_struct_decl directly with gfc_dt_upper_string (name) result.
* trans-stmt.c (gfc_trans_allocate): Use gfc_get_string ("%s", x)
instead of gfc_get_string (x).
* module.c (gfc_dt_lower_string, gfc_dt_upper_string,
gfc_match_use, gfc_match_submodule, find_true_name, mio_pool_string,
mio_symtree_ref, mio_expr, mio_omp_udr_expr, load_generic_interfaces,
load_omp_udrs, load_needed, read_module, dump_module,
create_intrinsic_function, import_iso_c_binding_module,
create_int_parameter, create_int_parameter_array, create_derived_type,
use_iso_fortran_env_module): Likewise.
* error.c (gfc_diagnostic_starter, gfc_diagnostic_start_span): Use
pp_verbatim (context->printer, "%s", x) instead of
pp_verbatim (context->printer, x).
* match.c (gfc_match_small_int): Adjust gfc_extract_int caller, pass
1 as new last argument to it, don't emit gfc_error.
(gfc_match_small_int_expr): Likewise.
* iresolve.c (gfc_get_string): Optimize format "%s" case.
(resolve_bound): Use gfc_get_string ("%s", x) instead of
gfc_get_string (x).
(resolve_transformational): Formatting fix.
(gfc_resolve_char_achar): Change name argument to bool is_achar,
use a single format string and if is_achar add "a" before "char".
(gfc_resolve_achar, gfc_resolve_char): Adjust callers.
* expr.c (gfc_extract_int): Change return type to bool, return true
if some error occurred. Add REPORT_ERROR argument, if non-zero
call either gfc_error or gfc_error_now depending on its sign.
* arith.c (arith_power): Adjust gfc_extract_int caller.
* symbol.c (gfc_add_component): Use gfc_get_string ("%s", x) instead
of gfc_get_string (x).
(gfc_new_symtree, gfc_delete_symtree, gfc_get_uop, gfc_new_symbol,
gfc_get_gsymbol, generate_isocbinding_symbol): Likewise.
* openmp.c (gfc_match_omp_clauses): Adjust gfc_extract_int caller, pass
-1 as new last argument to it, don't emit gfc_error_now.
(gfc_match_omp_declare_reduction): Use gfc_get_string ("%s", x)
instead of gfc_get_string (x).
* check.c (kind_check): Adjust gfc_extract_int caller.
* intrinsic.c (add_sym, find_sym, make_alias): Use
gfc_get_string ("%s", x) instead of gfc_get_string (x).
* simplify.c (get_kind, gfc_simplify_btest, gfc_simplify_maskr,
gfc_simplify_maskl, gfc_simplify_poppar, gfc_simplify_repeat,
gfc_simplify_selected_int_kind, gfc_simplify_selected_real_kind):
Adjust gfc_extract_int callers.
* trans-decl.c (gfc_find_module): Use gfc_get_string ("%s", x)
instead of gfc_get_string (x).
* matchexp.c (expression_syntax): Add const.
* primary.c (match_kind_param, match_hollerith_constant,
match_string_constant): Adjust gfc_extract_int callers.
(match_keyword_arg): Use gfc_get_string ("%s", x) instead of
gfc_get_string (x).
* frontend-passes.c (optimize_minmaxloc): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244744 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r-- | gcc/fortran/simplify.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 942b4015447..8ffe75a4a46 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -127,7 +127,7 @@ get_kind (bt type, gfc_expr *k, const char *name, int default_kind) return -1; } - if (gfc_extract_int (k, &kind) != NULL + if (gfc_extract_int (k, &kind) || gfc_validate_kind (type, kind, true) < 0) { gfc_error ("Invalid KIND parameter of %s at %L", name, &k->where); @@ -1499,7 +1499,7 @@ gfc_simplify_btest (gfc_expr *e, gfc_expr *bit) if (e->expr_type != EXPR_CONSTANT || bit->expr_type != EXPR_CONSTANT) return NULL; - if (gfc_extract_int (bit, &b) != NULL || b < 0) + if (gfc_extract_int (bit, &b) || b < 0) return gfc_get_logical_expr (gfc_default_logical_kind, &e->where, false); return gfc_get_logical_expr (gfc_default_logical_kind, &e->where, @@ -4234,7 +4234,6 @@ gfc_simplify_maskr (gfc_expr *i, gfc_expr *kind_arg) { gfc_expr *result; int kind, arg, k; - const char *s; if (i->expr_type != EXPR_CONSTANT) return NULL; @@ -4244,8 +4243,8 @@ gfc_simplify_maskr (gfc_expr *i, gfc_expr *kind_arg) return &gfc_bad_expr; k = gfc_validate_kind (BT_INTEGER, kind, false); - s = gfc_extract_int (i, &arg); - gcc_assert (!s); + bool fail = gfc_extract_int (i, &arg); + gcc_assert (!fail); result = gfc_get_constant_expr (BT_INTEGER, kind, &i->where); @@ -4265,7 +4264,6 @@ gfc_simplify_maskl (gfc_expr *i, gfc_expr *kind_arg) { gfc_expr *result; int kind, arg, k; - const char *s; mpz_t z; if (i->expr_type != EXPR_CONSTANT) @@ -4276,8 +4274,8 @@ gfc_simplify_maskl (gfc_expr *i, gfc_expr *kind_arg) return &gfc_bad_expr; k = gfc_validate_kind (BT_INTEGER, kind, false); - s = gfc_extract_int (i, &arg); - gcc_assert (!s); + bool fail = gfc_extract_int (i, &arg); + gcc_assert (!fail); result = gfc_get_constant_expr (BT_INTEGER, kind, &i->where); @@ -5060,7 +5058,6 @@ gfc_expr * gfc_simplify_poppar (gfc_expr *e) { gfc_expr *popcnt; - const char *s; int i; if (e->expr_type != EXPR_CONSTANT) @@ -5069,8 +5066,8 @@ gfc_simplify_poppar (gfc_expr *e) popcnt = gfc_simplify_popcnt (e); gcc_assert (popcnt); - s = gfc_extract_int (popcnt, &i); - gcc_assert (!s); + bool fail = gfc_extract_int (popcnt, &i); + gcc_assert (!fail); return gfc_get_int_expr (gfc_default_integer_kind, &e->where, i % 2); } @@ -5282,8 +5279,8 @@ gfc_simplify_repeat (gfc_expr *e, gfc_expr *n) (e->ts.u.cl->length && mpz_sgn (e->ts.u.cl->length->value.integer) != 0)) { - const char *res = gfc_extract_int (n, &ncop); - gcc_assert (res == NULL); + bool fail = gfc_extract_int (n, &ncop); + gcc_assert (!fail); } else ncop = 0; @@ -5693,7 +5690,7 @@ gfc_simplify_selected_int_kind (gfc_expr *e) { int i, kind, range; - if (e->expr_type != EXPR_CONSTANT || gfc_extract_int (e, &range) != NULL) + if (e->expr_type != EXPR_CONSTANT || gfc_extract_int (e, &range)) return NULL; kind = INT_MAX; @@ -5722,7 +5719,7 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q, gfc_expr *rdx) else { if (p->expr_type != EXPR_CONSTANT - || gfc_extract_int (p, &precision) != NULL) + || gfc_extract_int (p, &precision)) return NULL; loc = &p->where; } @@ -5732,7 +5729,7 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q, gfc_expr *rdx) else { if (q->expr_type != EXPR_CONSTANT - || gfc_extract_int (q, &range) != NULL) + || gfc_extract_int (q, &range)) return NULL; if (!loc) @@ -5744,7 +5741,7 @@ gfc_simplify_selected_real_kind (gfc_expr *p, gfc_expr *q, gfc_expr *rdx) else { if (rdx->expr_type != EXPR_CONSTANT - || gfc_extract_int (rdx, &radix) != NULL) + || gfc_extract_int (rdx, &radix)) return NULL; if (!loc) |