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]

Re: [Patch, Fortran] Convert gfc_fatal_error to common diagnostics


FX wrote:
Please document, in the source, the difference between gfc_fatal_error and gfc_fatal_error_1. They currently have the same generic description, which wouldnât help people writing new front-end code to know which one to use. Moreover, if the transition will not be complete soon (or indeterminate), it should be added to the wikiâs list of partial transitions.

Well, the diagnostics conversion is on going and was only delayed due to delays of reviewing the line-map part of last patch. (That part was required for %C support; the last patch added the _2 variants for gfc_error_now/gfc_warning_now.) In any case, the support for %L should be ready soon. When that's in, there won't be any need for gfc*_error*/gfc*_warning* duplication any more.

Support for buffered output (and discarding it), will take a bit longer â but is also planed for GCC 5. This support is required for gfc_error/gfc_warning and, hence, for most diagnostic output.

Thus, I don't think it should be put into the wiki. (Admittedly, I also do not know which page you are referring to.) In any case, there are several PRs about issues fixed by the on-going change to the common diagnostics.

When that's done, there are still additional task for diagnostic improvements left (see PRs), all which required the common diagnostic in place.

Other than that, OK, and thanks for doing this tedious work.

Thanks for the review! For the diagnostic changes, you have mainly to thank Manuel, who is the driving force behind all diagnositic work (C, C++) and who did the lion share of the Fortran front end work (including the required changes in the common part).

Tobias

PS: Attached is the error.c part of the committed patch (r217600); I added a few lines above the functions _2/_1 to make clear when to use them. I hope that we can soon remove the old version.
Index: gcc/fortran/error.c
===================================================================
--- gcc/fortran/error.c	(Revision 217599)
+++ gcc/fortran/error.c	(Arbeitskopie)
@@ -933,6 +933,7 @@ gfc_notify_std (int std, const char *gmsgid, ...)
 
 
 /* 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, ...)
@@ -1086,6 +1087,7 @@ gfc_diagnostic_finalizer (diagnostic_context *cont
 }
 
 /* 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, ...)
@@ -1104,6 +1106,7 @@ 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, ...)
@@ -1122,6 +1125,7 @@ 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, ...)
@@ -1135,6 +1139,24 @@ 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
@@ -1213,6 +1235,7 @@ warning:
 
 
 /* Immediate error.  */
+/* Use gfc_error_now_2 instead, unless gmsgid contains a %L.  */
 
 void
 gfc_error_now (const char *gmsgid, ...)
@@ -1243,9 +1266,10 @@ 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;
 

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