Especially since color diagnostic is now the default [1], it makes sense to convert more gfortran diagnostics to use the common diagnostics.

For an example, see [1]. That also brings all the nice features like placing the warning option in brackets:
  Warning: USE statement at (1) has no ONLY qualifier [-Wuse-without-only]
Adding -Werror changes it to:
Error: USE statement at (1) has no ONLY qualifier [-Werror=use-without-only] -fno-diagnostics-show-caret compactifies the error into a single line without showing the source code – and other nice features.
[Thanks Manuel!]


This patch converts all gfc_fatal_error to the new scheme, except for those few using %L. As most calls could be converted, I renamed the old one to _1 instead of using the _2 name for the new one.

Additionally, I changed quoted strings from '%s' to %qs and added quotes around -farguments via %< … %>. That also has a colouring effect (default: black and bold).

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

PS: Manuel is working on %L support and buffered output (gfc_error, gfc_warning); thus, expect more colors in the next weeks. While I intent to convert gfc_intrinsic_error and the remaining gfc_{error,warning}_now (all which do not use %L).

PPS: Turning on colors comes too late for the command-line diagnostic - they always come up in blank and white.

[1] See https://gcc.gnu.org/gcc-5/changes.html under "Fortran" and under "C family".
2014-11-15  Tobias Burnus  <bur...@net-b.de>

gcc/fortran/
        * 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.

gcc/testsuite/
        * 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.

diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index ef2aa69..159e626 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -209,7 +209,7 @@ coarray:
 
   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;
     }
 
@@ -592,7 +592,7 @@ coarray:
 
   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;
     }
 
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 6f1fe3f..034b329 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -1482,8 +1482,8 @@ check_co_collective (gfc_expr *a, gfc_expr *image_idx, gfc_expr *stat,
 
   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;
     }
 
@@ -2569,7 +2569,7 @@ gfc_check_lcobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
 {
   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;
     }
 
@@ -4847,7 +4847,7 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub)
 
   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;
     }
 
@@ -4885,7 +4885,7 @@ gfc_check_num_images (gfc_expr *distance, gfc_expr *failed)
 {
   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;
     }
 
@@ -4927,7 +4927,7 @@ gfc_check_this_image (gfc_expr *coarray, gfc_expr *dim, gfc_expr *distance)
 {
   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;
     }
 
@@ -5126,7 +5126,7 @@ gfc_check_ucobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
 {
   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;
     }
 
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 7fb8d16..090e209 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -450,7 +450,7 @@ gfc_cpp_post_options (void)
 	  || 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;
@@ -548,7 +548,7 @@ gfc_cpp_init_0 (void)
 
 	  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));
 	}
@@ -559,7 +559,7 @@ gfc_cpp_init_0 (void)
     {
       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));
     }
 
@@ -666,7 +666,7 @@ gfc_cpp_done (void)
 	      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));
 	}
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index cbab731..5a42812 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -1135,6 +1135,23 @@ gfc_error_now_2 (const char *gmsgid, ...)
   va_end (argp);
 }
 
+
+/* Fatal error, never returns.  */
+
+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
@@ -1245,7 +1262,7 @@ gfc_error_now (const char *gmsgid, ...)
 /* Fatal error, never returns.  */
 
 void
-gfc_fatal_error (const char *gmsgid, ...)
+gfc_fatal_error_1 (const char *gmsgid, ...)
 {
   va_list argp;
 
diff --git a/gcc/fortran/gfc-diagnostic.def b/gcc/fortran/gfc-diagnostic.def
index 0f1044d..2b3caf1 100644
--- a/gcc/fortran/gfc-diagnostic.def
+++ b/gcc/fortran/gfc-diagnostic.def
@@ -30,7 +30,7 @@ DEFINE_DIAGNOSTIC_KIND (DK_UNSPECIFIED, "", NULL)
 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")
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 83d2b1a..b0f15b4 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2707,6 +2707,7 @@ void gfc_warning_check (void);
 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);
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 84e2764..a03b5f1 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -557,8 +557,8 @@ gfc_match_name (char *buffer)
 
   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;
     }
 
@@ -1665,7 +1665,8 @@ gfc_match_critical (void)
 
   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;
     }
 
@@ -2726,7 +2727,7 @@ lock_unlock_statement (gfc_statement st)
 
   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;
     }
 
@@ -2922,7 +2923,8 @@ sync_statement (gfc_statement st)
 
   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;
     }
 
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 56351f0..b88e669 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1054,15 +1054,15 @@ bad_module (const char *msgid)
   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;
     }
@@ -6010,7 +6010,7 @@ gfc_dump_module (const char *name, int dump_flag)
   /* 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",
@@ -6030,7 +6030,7 @@ gfc_dump_module (const char *name, int dump_flag)
   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
@@ -6041,10 +6041,10 @@ gfc_dump_module (const char *name, int dump_flag)
     {
       /* 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
@@ -6789,7 +6789,7 @@ gfc_use_module (gfc_use_list *module)
       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
@@ -6814,7 +6814,7 @@ gfc_use_module (gfc_use_list *module)
     }
 
   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
@@ -6845,7 +6845,7 @@ gfc_use_module (gfc_use_list *module)
 	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)
 	{
@@ -6853,7 +6853,7 @@ gfc_use_module (gfc_use_list *module)
 	      || 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);
 
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 74b4d6d..bbbd6ab 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -489,7 +489,7 @@ gfc_handle_module_path_options (const char *arg)
 {
 
   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);
@@ -561,9 +561,9 @@ gfc_handle_fpe_option (const char *arg, bool trap)
 	    }
 	  }
       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);
 
     }
 }
@@ -579,7 +579,7 @@ gfc_handle_coarray_option (const char *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);
 }
 
 
@@ -617,7 +617,7 @@ gfc_handle_runtime_check_option (const char *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);
     }
 }
 
@@ -823,7 +823,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
 
     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;
 
@@ -845,7 +845,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
 
     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;
 
@@ -859,7 +859,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
 
     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;
@@ -974,7 +974,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
       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;
 
@@ -990,7 +990,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
       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;
 
@@ -1006,7 +1006,7 @@ gfc_handle_option (size_t scode, const char *arg, int value,
 	  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;
 
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 92b72ba..3a73867 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4634,7 +4634,7 @@ gfc_simplify_num_images (gfc_expr *distance ATTRIBUTE_UNUSED, gfc_expr *failed)
 
   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;
     }
 
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 9218738..4e5fd68 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -5425,11 +5425,11 @@ gfc_conv_array_initializer (tree type, gfc_expr * 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)
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index b36acbe..a594da7 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -865,9 +865,9 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
 	{
 	  /* 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;
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 060bf58..311b545 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -496,7 +496,8 @@ gfc_init_kinds (void)
   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;
 
@@ -504,7 +505,8 @@ gfc_init_kinds (void)
   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;
     }
@@ -522,28 +524,32 @@ gfc_init_kinds (void)
   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;
   }
@@ -557,7 +563,8 @@ gfc_init_kinds (void)
      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;
@@ -566,21 +573,24 @@ gfc_init_kinds (void)
   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;
     }
diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_4.f03 b/gcc/testsuite/gfortran.dg/binding_label_tests_4.f03
index 455726e7..69db975 100644
--- a/gcc/testsuite/gfortran.dg/binding_label_tests_4.f03
+++ b/gcc/testsuite/gfortran.dg/binding_label_tests_4.f03
@@ -20,5 +20,4 @@ module C
 use A
 use B ! { dg-error "Can't open module file" }
 end module C
-
-
+! { dg-excess-errors "compilation terminated" }
diff --git a/gcc/testsuite/gfortran.dg/coarray_9.f90 b/gcc/testsuite/gfortran.dg/coarray_9.f90
index cdfb4dc..0a4dbec 100644
--- a/gcc/testsuite/gfortran.dg/coarray_9.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_9.f90
@@ -16,3 +16,4 @@ critical ! "Coarrays disabled"  (but error above is fatal)
 end critical ! "Expecting END PROGRAM statement"  (but error above is fatal)
 
 end
+! { dg-excess-errors "compilation terminated" }
diff --git a/gcc/testsuite/gfortran.dg/empty_label.f b/gcc/testsuite/gfortran.dg/empty_label.f
index 446fe8b..5abf9d9 100644
--- a/gcc/testsuite/gfortran.dg/empty_label.f
+++ b/gcc/testsuite/gfortran.dg/empty_label.f
@@ -3,3 +3,4 @@ C { dg-options "-Werror -fmax-errors=1" }
 100   ! { dg-warning "empty statement" }
       end
 C { dg-error "count reached limit" "" { target *-*-* } 0 }
+C { dg-excess-errors "compilation terminated" }
diff --git a/gcc/testsuite/gfortran.dg/empty_label.f90 b/gcc/testsuite/gfortran.dg/empty_label.f90
index 6300d30..d7f4a8f 100644
--- a/gcc/testsuite/gfortran.dg/empty_label.f90
+++ b/gcc/testsuite/gfortran.dg/empty_label.f90
@@ -3,3 +3,4 @@
 100   ! { dg-warning "empty statement" }
 end
 ! { dg-error "count reached limit" "" { target *-*-* } 0 }
+! { dg-excess-errors "compilation terminated" }

Reply via email to