aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-01-21 11:30:54 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-01-21 11:30:54 +0100
commit51f03c6b11a46d756ae05c67e34cca2ccb4fafaa (patch)
treea3c04db8f13bc28886f7a7a7f58defc6d3b7c3be /gcc/fortran/decl.c
parentc6c82710eda68ad57d06b50e42c009b42e7ea610 (diff)
downloadgcc-51f03c6b11a46d756ae05c67e34cca2ccb4fafaa.zip
gcc-51f03c6b11a46d756ae05c67e34cca2ccb4fafaa.tar.gz
gcc-51f03c6b11a46d756ae05c67e34cca2ccb4fafaa.tar.bz2
gfortran.h (gfc_extract_int): Change return type to bool.
* 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. From-SVN: r244744
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 41acc94..a92e06a 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2540,7 +2540,6 @@ gfc_match_kind_spec (gfc_typespec *ts, bool kind_expr_only)
gfc_expr *e;
match m, n;
char c;
- const char *msg;
m = MATCH_NO;
n = MATCH_YES;
@@ -2598,11 +2597,8 @@ kind_expr:
goto no_match;
}
- msg = gfc_extract_int (e, &ts->kind);
-
- if (msg != NULL)
+ if (gfc_extract_int (e, &ts->kind, 1))
{
- gfc_error (msg);
m = MATCH_ERROR;
goto no_match;
}
@@ -2700,7 +2696,7 @@ match_char_kind (int * kind, int * is_iso_c)
locus where;
gfc_expr *e;
match m, n;
- const char *msg;
+ bool fail;
m = MATCH_NO;
e = NULL;
@@ -2730,11 +2726,10 @@ match_char_kind (int * kind, int * is_iso_c)
goto no_match;
}
- msg = gfc_extract_int (e, kind);
+ fail = gfc_extract_int (e, kind, 1);
*is_iso_c = e->ts.is_iso_c;
- if (msg != NULL)
+ if (fail)
{
- gfc_error (msg);
m = MATCH_ERROR;
goto no_match;
}
@@ -3302,7 +3297,7 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
/* Use upper case to save the actual derived-type symbol. */
gfc_get_symbol (dt_name, NULL, &dt_sym);
- dt_sym->name = gfc_get_string (sym->name);
+ dt_sym->name = gfc_get_string ("%s", sym->name);
head = sym->generic;
intr = gfc_get_interface ();
intr->sym = dt_sym;
@@ -8743,8 +8738,7 @@ gfc_match_structure_decl (void)
/* Store the actual type symbol for the structure with an upper-case first
letter (an invalid Fortran identifier). */
- sprintf (name, gfc_dt_upper_string (name));
- if (!get_struct_decl (name, FL_STRUCT, &where, &sym))
+ if (!get_struct_decl (gfc_dt_upper_string (name), FL_STRUCT, &where, &sym))
return MATCH_ERROR;
gfc_new_block = sym;
@@ -8937,7 +8931,7 @@ gfc_match_derived_decl (void)
{
/* Use upper case to save the actual derived-type symbol. */
gfc_get_symbol (gfc_dt_upper_string (gensym->name), NULL, &sym);
- sym->name = gfc_get_string (gensym->name);
+ sym->name = gfc_get_string ("%s", gensym->name);
head = gensym->generic;
intr = gfc_get_interface ();
intr->sym = sym;
@@ -9357,7 +9351,7 @@ match_binding_attributes (gfc_typebound_proc* ba, bool generic, bool ppc)
if (m == MATCH_ERROR)
goto error;
if (m == MATCH_YES)
- ba->pass_arg = gfc_get_string (arg);
+ ba->pass_arg = gfc_get_string ("%s", arg);
gcc_assert ((m == MATCH_YES) == (ba->pass_arg != NULL));
found_passing = true;