diff mbox

[Fortran] Convert gfc_fatal_error to common diagnostics

Message ID 54673545.5070802@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Nov. 15, 2014, 11:13 a.m. UTC
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.

Comments

FX Coudert Nov. 15, 2014, 11:58 a.m. UTC | #1
> 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.

OK. (The page I was referring to is here: https://gcc.gnu.org/wiki/Partial_Transitions)


FX
diff mbox

Patch

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;