+2014-11-15 Tobias Burnus <burnus@net-b.de>
+
+ * error.c (gfc_fatal_error_1): Renamed from gfc_fatal_error.
+ (gfc_fatal_error): Add; uses common diagnostics.
+ * array.c (gfc_match_array_ref, gfc_match_array_spec): Use
+ %< %>.
+ * check.c (check_co_collective, gfc_check_lcobound,
+ gfc_check_image_index, gfc_check_num_images,
+ gfc_check_this_image, gfc_check_ucobound): Ditto.
+ * cpp.c (gfc_cpp_post_options): Ditto.
+ (gfc_cpp_init_0, gfc_cpp_done): Change %s to %qs.
+ * gfc-diagnostic.def (DK_FATAL): Capitalize first letter.
+ * gfortran.h (gfc_fatal_error_1): Add.
+ * match.c (gfc_match_name, gfc_match_critical,
+ lock_unlock_statement, sync_statement): Add %< %>.
+ * module.c (bad_module, gfc_dump_module, gfc_use_module): Change
+ %s to %qs.
+ * options.c (gfc_handle_module_path_options, gfc_handle_fpe_option,
+ gfc_handle_coarray_option, gfc_handle_runtime_check_option,
+ gfc_handle_option): Add %< %>.
+ * simplify.c (gfc_simplify_num_images): Ditto.
+ * trans-stmt.c (gfc_trans_sync): Use gfc_fatal_error_1.
+ * trans-array.c (gfc_conv_array_initializer): Ditto.
+ * trans-types.c (gfc_init_kinds): Use gfc_fatal_error instead
+ of fatal_error; add %< %> quotations.
+
2014-11-13 Bernd Schmidt <bernds@codesourcery.com>
Thomas Schwinge <thomas@codesourcery.com>
Ilya Verbin <ilya.verbin@intel.com>
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
goto cleanup;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %L, use -fcoarray= to enable",
- &a->where);
+ gfc_fatal_error_1 ("Coarrays disabled at %L, use -fcoarray= to enable",
+ &a->where);
return false;
}
{
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
}
{
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
}
{
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
}
{
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
}
|| gfc_cpp_option.no_line_commands
|| gfc_cpp_option.dump_macros
|| gfc_cpp_option.dump_includes))
- gfc_fatal_error("To enable preprocessing, use -cpp");
+ gfc_fatal_error ("To enable preprocessing, use %<-cpp%>");
if (!gfc_cpp_enabled ())
return;
print.outf = fopen (gfc_cpp_option.output_filename, "w");
if (print.outf == NULL)
- gfc_fatal_error ("opening output file %s: %s",
+ gfc_fatal_error ("opening output file %qs: %s",
gfc_cpp_option.output_filename,
xstrerror (errno));
}
{
print.outf = fopen (gfc_cpp_option.temporary_filename, "w");
if (print.outf == NULL)
- gfc_fatal_error ("opening output file %s: %s",
+ gfc_fatal_error ("opening output file %qs: %s",
gfc_cpp_option.temporary_filename, xstrerror (errno));
}
fclose (f);
}
else
- gfc_fatal_error ("opening output file %s: %s",
+ gfc_fatal_error ("opening output file %qs: %s",
gfc_cpp_option.deps_filename,
xstrerror (errno));
}
/* Immediate warning (i.e. do not buffer the warning). */
+/* Use gfc_warning_now_2 instead, unless gmsgid contains a %L. */
void
gfc_warning_now (const char *gmsgid, ...)
}
/* Immediate warning (i.e. do not buffer the warning). */
+/* This function uses the common diagnostics, but does not support %L, yet. */
bool
gfc_warning_now_2 (int opt, const char *gmsgid, ...)
}
/* Immediate warning (i.e. do not buffer the warning). */
+/* This function uses the common diagnostics, but does not support %L, yet. */
bool
gfc_warning_now_2 (const char *gmsgid, ...)
/* Immediate error (i.e. do not buffer). */
+/* This function uses the common diagnostics, but does not support %L, yet. */
void
gfc_error_now_2 (const char *gmsgid, ...)
va_end (argp);
}
+
+/* Fatal error, never returns. */
+/* This function uses the common diagnostics, but does not support %L, yet. */
+
+void
+gfc_fatal_error (const char *gmsgid, ...)
+{
+ va_list argp;
+ diagnostic_info diagnostic;
+
+ va_start (argp, gmsgid);
+ diagnostic_set_info (&diagnostic, gmsgid, &argp, UNKNOWN_LOCATION, DK_FATAL);
+ report_diagnostic (&diagnostic);
+ va_end (argp);
+
+ gcc_unreachable ();
+}
+
/* Clear the warning flag. */
void
/* Immediate error. */
+/* Use gfc_error_now_2 instead, unless gmsgid contains a %L. */
void
gfc_error_now (const char *gmsgid, ...)
/* Fatal error, never returns. */
+/* Use gfc_fatal_error instead, unless gmsgid contains a %L. */
void
-gfc_fatal_error (const char *gmsgid, ...)
+gfc_fatal_error_1 (const char *gmsgid, ...)
{
va_list argp;
DEFINE_DIAGNOSTIC_KIND (DK_IGNORED, "", NULL)
/* The remainder are real diagnostic types. */
-DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "fatal error", "error")
+DEFINE_DIAGNOSTIC_KIND (DK_FATAL, "Fatal Error", "error")
DEFINE_DIAGNOSTIC_KIND (DK_ICE, "internal compiler error", "error")
DEFINE_DIAGNOSTIC_KIND (DK_ERROR, "Error", "error")
DEFINE_DIAGNOSTIC_KIND (DK_SORRY, "sorry, unimplemented", "error")
void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2);
void gfc_error_now_2 (const char *gmsgid, ...) ATTRIBUTE_GCC_GFC(1,2);
+void gfc_fatal_error_1 (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2);
void gfc_clear_error (void);
if (c == '$' && !gfc_option.flag_dollar_ok)
{
- gfc_fatal_error ("Invalid character '$' at %L. Use -fdollar-ok to allow "
- "it as an extension", &old_loc);
+ gfc_fatal_error_1 ("Invalid character '$' at %L. Use -fdollar-ok to allow"
+ " it as an extension", &old_loc);
return MATCH_ERROR;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
+ "enable");
return MATCH_ERROR;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
}
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
+ "enable");
return MATCH_ERROR;
}
switch (iomode)
{
case IO_INPUT:
- gfc_fatal_error ("Reading module %s at line %d column %d: %s",
+ gfc_fatal_error ("Reading module %qs at line %d column %d: %s",
module_name, module_line, module_column, msgid);
break;
case IO_OUTPUT:
- gfc_fatal_error ("Writing module %s at line %d column %d: %s",
+ gfc_fatal_error ("Writing module %qs at line %d column %d: %s",
module_name, module_line, module_column, msgid);
break;
default:
- gfc_fatal_error ("Module %s at line %d column %d: %s",
+ gfc_fatal_error ("Module %qs at line %d column %d: %s",
module_name, module_line, module_column, msgid);
break;
}
/* Write the module to the temporary file. */
module_fp = gzopen (filename_tmp, "w");
if (module_fp == NULL)
- gfc_fatal_error ("Can't open module file '%s' for writing at %C: %s",
+ gfc_fatal_error ("Can't open module file %qs for writing at %C: %s",
filename_tmp, xstrerror (errno));
gzprintf (module_fp, "GFORTRAN module version '%s' created from %s\n",
write_char ('\n');
if (gzclose (module_fp))
- gfc_fatal_error ("Error writing module file '%s' for writing: %s",
+ gfc_fatal_error ("Error writing module file %qs for writing: %s",
filename_tmp, xstrerror (errno));
/* Read the CRC32 from the gzip trailers of the module files and
{
/* Module file have changed, replace the old one. */
if (remove (filename) && errno != ENOENT)
- gfc_fatal_error ("Can't delete module file '%s': %s", filename,
+ gfc_fatal_error ("Can't delete module file %qs: %s", filename,
xstrerror (errno));
if (rename (filename_tmp, filename))
- gfc_fatal_error ("Can't rename module file '%s' to '%s': %s",
+ gfc_fatal_error ("Can't rename module file %qs to %qs: %s",
filename_tmp, filename, xstrerror (errno));
}
else
module_fp = gzopen_intrinsic_module (filename);
if (module_fp == NULL && module->intrinsic)
- gfc_fatal_error ("Can't find an intrinsic module named '%s' at %C",
+ gfc_fatal_error ("Can't find an intrinsic module named %qs at %C",
module_name);
/* Check for the IEEE modules, so we can mark their symbols
}
if (module_fp == NULL)
- gfc_fatal_error ("Can't open module file '%s' for reading at %C: %s",
+ gfc_fatal_error ("Can't open module file %qs for reading at %C: %s",
filename, xstrerror (errno));
/* Check that we haven't already USEd an intrinsic module with the
parse_name (c);
if ((start == 1 && strcmp (atom_name, "GFORTRAN") != 0)
|| (start == 2 && strcmp (atom_name, " module") != 0))
- gfc_fatal_error ("File '%s' opened at %C is not a GNU Fortran"
+ gfc_fatal_error ("File %qs opened at %C is not a GNU Fortran"
" module file", filename);
if (start == 3)
{
|| module_char () != ' '
|| parse_atom () != ATOM_STRING
|| strcmp (atom_string, MOD_VERSION))
- gfc_fatal_error ("Cannot read module file '%s' opened at %C,"
+ gfc_fatal_error ("Cannot read module file %qs opened at %C,"
" because it was created by a different"
" version of GNU Fortran", filename);
{
if (gfc_option.module_dir != NULL)
- gfc_fatal_error ("gfortran: Only one -J option allowed");
+ gfc_fatal_error ("gfortran: Only one %<-J%> option allowed");
gfc_option.module_dir = XCNEWVEC (char, strlen (arg) + 2);
strcpy (gfc_option.module_dir, arg);
}
}
if (!result && !trap)
- gfc_fatal_error ("Argument to -ffpe-trap is not valid: %s", arg);
+ gfc_fatal_error ("Argument to %<-ffpe-trap%> is not valid: %s", arg);
else if (!result)
- gfc_fatal_error ("Argument to -ffpe-summary is not valid: %s", arg);
+ gfc_fatal_error ("Argument to %<-ffpe-summary%> is not valid: %s", arg);
}
}
else if (strcmp (arg, "lib") == 0)
gfc_option.coarray = GFC_FCOARRAY_LIB;
else
- gfc_fatal_error ("Argument to -fcoarray is not valid: %s", arg);
+ gfc_fatal_error ("Argument to %<-fcoarray%> is not valid: %s", arg);
}
}
}
if (!result)
- gfc_fatal_error ("Argument to -fcheck is not valid: %s", arg);
+ gfc_fatal_error ("Argument to %<-fcheck%> is not valid: %s", arg);
}
}
case OPT_ffixed_line_length_:
if (value != 0 && value < 7)
- gfc_fatal_error ("Fixed line length must be at least seven.");
+ gfc_fatal_error ("Fixed line length must be at least seven");
gfc_option.fixed_line_length = value;
break;
case OPT_ffree_line_length_:
if (value != 0 && value < 4)
- gfc_fatal_error ("Free line length must be at least three.");
+ gfc_fatal_error ("Free line length must be at least three");
gfc_option.free_line_length = value;
break;
case OPT_static_libgfortran:
#ifndef HAVE_LD_STATIC_DYNAMIC
- gfc_fatal_error ("-static-libgfortran is not supported in this "
+ gfc_fatal_error ("%<-static-libgfortran%> is not supported in this "
"configuration");
#endif
break;
else if (!strcasecmp (arg, "true"))
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_TRUE;
else
- gfc_fatal_error ("Unrecognized option to -finit-logical: %s",
+ gfc_fatal_error ("Unrecognized option to %<-finit-logical%>: %s",
arg);
break;
else if (!strcasecmp (arg, "-inf"))
gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
else
- gfc_fatal_error ("Unrecognized option to -finit-real: %s",
+ gfc_fatal_error ("Unrecognized option to %<-finit-real%>: %s",
arg);
break;
gfc_option.flag_init_character_value = (char)value;
}
else
- gfc_fatal_error ("The value of n in -finit-character=n must be "
+ gfc_fatal_error ("The value of n in %<-finit-character=n%> must be "
"between 0 and 127");
break;
if (gfc_option.coarray == GFC_FCOARRAY_NONE)
{
- gfc_fatal_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return &gfc_bad_expr;
}
{
/* Problems occur when we get something like
integer :: a(lots) = (/(i, i=1, lots)/) */
- gfc_fatal_error ("The number of elements in the array constructor "
- "at %L requires an increase of the allowed %d "
- "upper limit. See -fmax-array-constructor "
- "option", &expr->where,
- gfc_option.flag_max_array_constructor);
+ gfc_fatal_error_1 ("The number of elements in the array "
+ "constructor at %L requires an increase of "
+ "the allowed %d upper limit. See "
+ "-fmax-array-constructor option", &expr->where,
+ gfc_option.flag_max_array_constructor);
return NULL_TREE;
}
if (mpz_cmp_si (c->offset, 0) != 0)
{
/* FIXME. */
if (code->expr1->ts.kind != gfc_c_int_kind)
- gfc_fatal_error ("Sorry, only support for integer kind %d "
- "implemented for image-set at %L",
- gfc_c_int_kind, &code->expr1->where);
+ gfc_fatal_error_1 ("Sorry, only support for integer kind %d "
+ "implemented for image-set at %L",
+ gfc_c_int_kind, &code->expr1->where);
gfc_conv_array_parameter (&se, code->expr1, true, NULL, NULL, &len);
images = se.expr;
if (gfc_option.flag_default_integer)
{
if (!saw_i8)
- fatal_error ("INTEGER(KIND=8) is not available for -fdefault-integer-8 option");
+ gfc_fatal_error ("INTEGER(KIND=8) is not available for "
+ "%<-fdefault-integer-8%> option");
gfc_default_integer_kind = 8;
else if (gfc_option.flag_integer4_kind == 8)
{
if (!saw_i8)
- fatal_error ("INTEGER(KIND=8) is not available for -finteger-4-integer-8 option");
+ gfc_fatal_error ("INTEGER(KIND=8) is not available for "
+ "%<-finteger-4-integer-8%> option");
gfc_default_integer_kind = 8;
}
if (gfc_option.flag_default_real)
{
if (!saw_r8)
- fatal_error ("REAL(KIND=8) is not available for -fdefault-real-8 option");
+ gfc_fatal_error ("REAL(KIND=8) is not available for "
+ "%<-fdefault-real-8%> option");
gfc_default_real_kind = 8;
}
else if (gfc_option.flag_real4_kind == 8)
{
if (!saw_r8)
- fatal_error ("REAL(KIND=8) is not available for -freal-4-real-8 option");
+ gfc_fatal_error ("REAL(KIND=8) is not available for %<-freal-4-real-8%> "
+ "option");
gfc_default_real_kind = 8;
}
else if (gfc_option.flag_real4_kind == 10)
{
if (!saw_r10)
- fatal_error ("REAL(KIND=10) is not available for -freal-4-real-10 option");
+ gfc_fatal_error ("REAL(KIND=10) is not available for "
+ "%<-freal-4-real-10%> option");
gfc_default_real_kind = 10;
}
else if (gfc_option.flag_real4_kind == 16)
{
if (!saw_r16)
- fatal_error ("REAL(KIND=16) is not available for -freal-4-real-16 option");
+ gfc_fatal_error ("REAL(KIND=16) is not available for "
+ "%<-freal-4-real-16%> option");
gfc_default_real_kind = 16;
}
specified without -fdefault-double, we use kind=16, if it's available.
Otherwise we do not change anything. */
if (gfc_option.flag_default_double && !gfc_option.flag_default_real)
- fatal_error ("Use of -fdefault-double-8 requires -fdefault-real-8");
+ gfc_fatal_error ("Use of %<-fdefault-double-8%> requires "
+ "%<-fdefault-real-8%>");
if (gfc_option.flag_default_real && gfc_option.flag_default_double && saw_r8)
gfc_default_double_kind = 8;
else if (gfc_option.flag_real8_kind == 4)
{
if (!saw_r4)
- fatal_error ("REAL(KIND=4) is not available for -freal-8-real-4 option");
+ gfc_fatal_error ("REAL(KIND=4) is not available for "
+ "%<-freal-8-real-4%> option");
gfc_default_double_kind = 4;
}
else if (gfc_option.flag_real8_kind == 10 )
{
if (!saw_r10)
- fatal_error ("REAL(KIND=10) is not available for -freal-8-real-10 option");
+ gfc_fatal_error ("REAL(KIND=10) is not available for "
+ "%<-freal-8-real-10%> option");
gfc_default_double_kind = 10;
}
else if (gfc_option.flag_real8_kind == 16 )
{
if (!saw_r16)
- fatal_error ("REAL(KIND=10) is not available for -freal-8-real-16 option");
+ gfc_fatal_error ("REAL(KIND=10) is not available for "
+ "%<-freal-8-real-16%> option");
gfc_default_double_kind = 16;
}
+2014-11-15 Tobias Burnus <burnus@net-b.de>
+
+ * gfortran.dg/binding_label_tests_4.f03: Add dg-excess-errors.
+ * gfortran.dg/coarray_9.f90: Ditto.
+ * gfortran.dg/empty_label.f: Ditto.
+ * gfortran.dg/empty_label.f90: Ditto.
+
2014-11-14 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/ppc-fpconv-1.c: Adjust for -mupper-regs-df
use A
use B ! { dg-error "Can't open module file" }
end module C
-
-
+! { dg-excess-errors "compilation terminated" }
end critical ! "Expecting END PROGRAM statement" (but error above is fatal)
end
+! { dg-excess-errors "compilation terminated" }
100 ! { dg-warning "empty statement" }
end
C { dg-error "count reached limit" "" { target *-*-* } 0 }
+C { dg-excess-errors "compilation terminated" }
100 ! { dg-warning "empty statement" }
end
! { dg-error "count reached limit" "" { target *-*-* } 0 }
+! { dg-excess-errors "compilation terminated" }