From 17d5d49f584e47e20bdbe16404c2be5af9db4e08 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 25 Nov 2014 23:37:54 +0100 Subject: [PATCH] error.c (gfc_internal_error): Convert to common diagnostics. 2014-11-25 Tobias Burnus * error.c (gfc_internal_error): Convert to common diagnostics. * interface.c (gfc_find_sym_in_symtree): Use %qs. * intrinsic.c (make_generic, gfc_check_intrinsic_standard, gfc_convert_type_warn): Ditto. * module.c (write_symbol): Ditto. * symbol.c (gfc_get_default_type): Ditto; use fatal instead of internal error. * trans-array.c (gfc_walk_subexpr): Replace internal_error by gfc_internal_error. * trans-decl.c (gfc_get_symbol_decl, (gfc_create_module_variable): Ditto. Use %qs. * trans-intrinsic.c (gfc_conv_intrinsic_lib_function): Ditto. * trans-io.c (transfer_expr): Ditto. * trans-openmp.c (gfc_trans_omp_workshare): Ditto. * trans.c (trans_code): Ditto. From-SVN: r218068 --- gcc/fortran/ChangeLog | 18 ++++++++++++++++++ gcc/fortran/error.c | 16 ++++++---------- gcc/fortran/interface.c | 2 +- gcc/fortran/intrinsic.c | 6 +++--- gcc/fortran/module.c | 2 +- gcc/fortran/symbol.c | 8 ++++---- gcc/fortran/trans-array.c | 2 +- gcc/fortran/trans-decl.c | 6 +++--- gcc/fortran/trans-intrinsic.c | 4 ++-- gcc/fortran/trans-io.c | 2 +- gcc/fortran/trans-openmp.c | 2 +- gcc/fortran/trans.c | 2 +- 12 files changed, 42 insertions(+), 28 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 970671a3553..68c941654f6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,21 @@ +2014-11-25 Tobias Burnus + + * error.c (gfc_internal_error): Convert to common diagnostics. + * interface.c (gfc_find_sym_in_symtree): Use %qs. + * intrinsic.c (make_generic, gfc_check_intrinsic_standard, + gfc_convert_type_warn): Ditto. + * module.c (write_symbol): Ditto. + * symbol.c (gfc_get_default_type): Ditto; use fatal instead + of internal error. + * trans-array.c (gfc_walk_subexpr): Replace internal_error by + gfc_internal_error. + * trans-decl.c (gfc_get_symbol_decl, + (gfc_create_module_variable): Ditto. Use %qs. + * trans-intrinsic.c (gfc_conv_intrinsic_lib_function): Ditto. + * trans-io.c (transfer_expr): Ditto. + * trans-openmp.c (gfc_trans_omp_workshare): Ditto. + * trans.c (trans_code): Ditto. + 2014-11-25 Tobias Burnus * gfortran.h (gfc_option_t): Remove flags moved as Var to .opt. diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index a0ad2ad9c71..00e92280ce3 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -1282,21 +1282,17 @@ gfc_error_now_1 (const char *gmsgid, ...) /* This shouldn't happen... but sometimes does. */ void -gfc_internal_error (const char *format, ...) +gfc_internal_error (const char *gmsgid, ...) { va_list argp; + diagnostic_info diagnostic; - buffer_flag = 0; - - va_start (argp, format); - - show_loci (&gfc_current_locus, NULL); - error_printf ("Internal Error at (1):"); - - error_print ("", format, argp); + va_start (argp, gmsgid); + diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION, DK_ICE); + report_diagnostic (&diagnostic); va_end (argp); - exit (ICE_EXIT_CODE); + gcc_unreachable (); } diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 1eb09ac250d..1980ddf662e 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -3542,7 +3542,7 @@ gfc_find_sym_in_symtree (gfc_symbol *sym) if (st) return st; } - gfc_internal_error ("Unable to find symbol %s", sym->name); + gfc_internal_error ("Unable to find symbol %qs", sym->name); /* Not reached. */ } diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 8cbcac980bb..6b874a4092f 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1086,7 +1086,7 @@ make_generic (const char *name, gfc_isym_id id, int standard ATTRIBUTE_UNUSED) g = gfc_find_function (name); if (g == NULL) - gfc_internal_error ("make_generic(): Can't find generic symbol '%s'", + gfc_internal_error ("make_generic(): Can't find generic symbol %qs", name); gcc_assert (g->id == id); @@ -4307,7 +4307,7 @@ gfc_check_intrinsic_standard (const gfc_intrinsic_sym* isym, break; default: - gfc_internal_error ("Invalid standard code on intrinsic '%s' (%d)", + gfc_internal_error ("Invalid standard code on intrinsic %qs (%d)", isym->name, isym->standard); } @@ -4735,7 +4735,7 @@ bad: return false; } - gfc_internal_error ("Can't convert %s to %s at %L", + gfc_internal_error ("Can't convert %qs to %qs at %L", gfc_typename (&from_ts), gfc_typename (ts), &expr->where); /* Not reached */ diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 2449bbcb37d..3adbe1a5bbd 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -5496,7 +5496,7 @@ write_symbol (int n, gfc_symbol *sym) const char *label; if (sym->attr.flavor == FL_UNKNOWN || sym->attr.flavor == FL_LABEL) - gfc_internal_error ("write_symbol(): bad module symbol '%s'", sym->name); + gfc_internal_error ("write_symbol(): bad module symbol %qs", sym->name); mio_integer (&n); diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index aeb7dce3ef2..fa0ffe06818 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -221,12 +221,12 @@ gfc_get_default_type (const char *name, gfc_namespace *ns) letter = name[0]; if (gfc_option.flag_allow_leading_underscore && letter == '_') - gfc_internal_error ("Option -fallow-leading-underscore is for use only by " - "gfortran developers, and should not be used for " - "implicitly typed variables"); + gfc_fatal_error ("Option %<-fallow-leading-underscore%> is for use only by " + "gfortran developers, and should not be used for " + "implicitly typed variables"); if (letter < 'a' || letter > 'z') - gfc_internal_error ("gfc_get_default_type(): Bad symbol '%s'", name); + gfc_internal_error ("gfc_get_default_type(): Bad symbol %qs", name); if (ns == NULL) ns = gfc_current_ns; diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 218d27444f9..a70aa0783eb 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -9093,7 +9093,7 @@ gfc_walk_subexpr (gfc_ss * ss, gfc_expr * expr) break; default: - internal_error ("bad expression type during walk (%d)", + gfc_internal_error ("bad expression type during walk (%d)", expr->expr_type); } return ss; diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 07fefd90b2a..eefd9bc696e 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1435,7 +1435,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) } if (sym->attr.intrinsic) - internal_error ("intrinsic variable which isn't a procedure"); + gfc_internal_error ("intrinsic variable which isn't a procedure"); /* Create string length decl first so that they can be used in the type declaration. */ @@ -4418,8 +4418,8 @@ gfc_create_module_variable (gfc_symbol * sym) return; if (sym->backend_decl && !sym->attr.vtab && !sym->attr.target) - internal_error ("backend decl for module variable %s already exists", - sym->name); + gfc_internal_error ("backend decl for module variable %qs already exists", + sym->name); if (sym->module && !sym->attr.result && !sym->attr.dummy && (sym->attr.access == ACCESS_UNKNOWN diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 932bf7972b5..6bf1f7439c5 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -856,8 +856,8 @@ gfc_conv_intrinsic_lib_function (gfc_se * se, gfc_expr * expr) if (m->id == GFC_ISYM_NONE) { - internal_error ("Intrinsic function %s(%d) not recognized", - expr->value.function.name, id); + gfc_internal_error ("Intrinsic function %qs (%d) not recognized", + expr->value.function.name, id); } /* Get the decl and generate the call. */ diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index fbf791263d3..e1b7eb9d10e 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -2192,7 +2192,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) return; default: - internal_error ("Bad IO basetype (%d)", ts->type); + gfc_internal_error ("Bad IO basetype (%d)", ts->type); } tmp = gfc_build_addr_expr (NULL_TREE, dt_parm); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index d7660d772ae..d1fad30ef79 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -3933,7 +3933,7 @@ gfc_trans_omp_workshare (gfc_code *code, gfc_omp_clauses *clauses) break; default: - internal_error ("gfc_trans_omp_workshare(): Bad statement code"); + gfc_internal_error ("gfc_trans_omp_workshare(): Bad statement code"); } gfc_set_backend_locus (&code->loc); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index b70702303e4..76fe7fd6e03 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1890,7 +1890,7 @@ trans_code (gfc_code * code, tree cond) break; default: - internal_error ("gfc_trans_code(): Bad statement code"); + gfc_internal_error ("gfc_trans_code(): Bad statement code"); } gfc_set_backend_locus (&code->loc); -- 2.30.2