This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] pr21061 - gfortran ignores -Werror


Bernhard Fischer wrote:
Attached is a revised and much simpler fix for PR fortran/21061 where
-Werror was ignored. The attached patch makes sure that we exit(1)
properly even for warnings.

I have a couple of belated question about this patch to error.c:


In the following code (gfc_warning, but gfc_warning_now is identical), it increments both errors and warnings when warnings_are_errors is true:

@@ -475,7 +475,12 @@ gfc_warning (const char *nocmsgid, ...)

  va_start (argp, nocmsgid);
  if (buffer_flag == 0)
+  {
    warnings++;
+    if (warnings_are_errors)
+      errors++;
+  }

However, in gfc_notify_std, when it would normally produce a warning but warnings_are_errors is true, it only increments errors, not warnings:


-      if (warning)
+      if (warning && !warnings_are_errors)
	warnings++;
      else
	errors++;

Is this discrepancy intentional, or should one of these be changed to be consistent with the other?



Also, there is this hunk in gfc_notify_std:
@@ -518,14 +523,15 @@ gfc_notify_std (int std, const char *noc
if (gfc_suppress_error)
return warning ? SUCCESS : FAILURE;
- - cur_error_buffer = warning ? &warning_buffer : &error_buffer;
+
+ cur_error_buffer = (warning && !warnings_are_errors)
+ ? &warning_buffer : &error_buffer;
cur_error_buffer->flag = 1;
cur_error_buffer->index = 0;

I don't follow why this is changed. In gfc_warning, when warnings are treated as errors, they're still buffered into warning_buffer rather than into error_buffer. Why buffer warnings into error_buffer here?


(In particular, I'm wondering if this has to do with lines 2606-2610 of match.c, which implement a gfc_notify_std_now sort of thing assuming that if gfc_notify_std has returned FAILURE that the result is in error_buffer, or whether there's a more global reason for it...?)

- Brooks


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