This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] Remove gfc_fatal_error_1


This patch depends on Manuel's %L patch.

It converts the remaining fatal error calls to the common diagnostic infrastructure and retires (removes) the old gfc_fatal_error_1.

I will build and regtest it after Manuel's commit.
OK, when it succeeds?

Tobias
2014-11-23  Tobias Burnus  <burnus@net-b.de>

	* error.c (gfc_fatal_error_1): Remove.
	* gfortran.h (gfc_fatal_error_1): Remove.
	* check.c (check_co_collective): Change gfc_fatal_error_1 to
	gfc_fatal_error.
	* match.c (gfc_match_name): Ditto.
	* trans-array.c (gfc_conv_array_initializer): Ditto.
	* trans-stmt.c (gfc_trans_sync): Ditto.

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 034b329..8da59d5 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_1 ("Coarrays disabled at %L, use -fcoarray= to enable",
-			 &a->where);
+      gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
+		       &a->where);
       return false;
     }
 
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 3a508fa..2378a4b 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -1141,7 +1141,6 @@ gfc_error_now_2 (const char *gmsgid, ...)
 
 
 /* Fatal error, never returns.  */
-/* This function uses the common diagnostics, but does not support %L, yet.  */
 
 void
 gfc_fatal_error (const char *gmsgid, ...)
@@ -1265,24 +1264,6 @@ gfc_error_now (const char *gmsgid, ...)
 }
 
 
-/* Fatal error, never returns.  */
-/* Use gfc_fatal_error instead, unless gmsgid contains a %L.  */
-
-void
-gfc_fatal_error_1 (const char *gmsgid, ...)
-{
-  va_list argp;
-
-  buffer_flag = 0;
-
-  va_start (argp, gmsgid);
-  error_print (_("Fatal Error:"), _(gmsgid), argp);
-  va_end (argp);
-
-  exit (FATAL_EXIT_CODE);
-}
-
-
 /* This shouldn't happen... but sometimes does.  */
 
 void
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 1ee7dd4..e6effba 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -2706,7 +2706,6 @@ 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 a03b5f1..a157fe7 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_1 ("Invalid character '$' at %L. Use -fdollar-ok to allow"
-			 " it as an extension", &old_loc);
+      gfc_fatal_error ("Invalid character %<$%> at %L. Use %<-fdollar-ok%> to "
+		       "allow it as an extension", &old_loc);
       return MATCH_ERROR;
     }
 
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 4e5fd68..218d274 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -5425,11 +5425,12 @@ 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_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);
+              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);
 	      return NULL_TREE;
 	    }
           if (mpz_cmp_si (c->offset, 0) != 0)
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index a95809c..d17b075 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.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_1 ("Sorry, only support for integer kind %d "
-			       "implemented for image-set at %L",
-			       gfc_c_int_kind, &code->expr1->where);
+	    gfc_fatal_error ("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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]