[PATCH/fortran] Add option to make 1st error fatal
Steve Kargl
sgk@troutmask.apl.washington.edu
Mon Oct 31 18:37:00 GMT 2005
On Sun, Oct 30, 2005 at 12:58:32PM -0800, Steve Kargl wrote:
>
> 2005-10-30 Steven G. Kargl <kargls@comcast.net>
>
> *lang.opt: Define -ffatal
> *gfortran.h: Add gfc_option.flag_fatal.
> *options.c(gfc_init_options,gfc_post_options): Set and use it.
> *error.c (gfc_error_check): Use it.
> *invoke.texi: Document -ffatal.
>
Round 3. Removed -Werror (which should actually be spelled -Werrors
for all front-end). Renamed -ffatal to -Wfatal-errors (which should
actaully be spelled -Wfatal-error). Bootstrapped and regression
tested on amd64-*-freebsd.
2005-10-30 Steven G. Kargl <kargls@comcast.net>
*lang.opt: Define -Wfatal_errors.
*gfortran.h: Add gfc_option.flag_fatal_errors.
*options.c(gfc_init_options,gfc_post_options): Set and use it.
*error.c (gfc_error_check): Use it.
*invoke.texi: Document.
--
Steve
-------------- next part --------------
Index: gfortran.h
===================================================================
--- gfortran.h (revision 106278)
+++ gfortran.h (working copy)
@@ -1453,6 +1453,7 @@
int warn_aliasing;
int warn_conversion;
+ int warn_fatal_errors;
int warn_implicit_interface;
int warn_line_truncation;
int warn_underflow;
Index: error.c
===================================================================
--- error.c (revision 106278)
+++ error.c (working copy)
@@ -687,6 +687,9 @@
if (error_buffer.message != NULL)
fputs (error_buffer.message, stderr);
error_buffer.flag = 0;
+
+ if (gfc_option.warn_fatal_errors)
+ exit (1);
}
return rc;
Index: lang.opt
===================================================================
--- lang.opt (revision 106278)
+++ lang.opt (working copy)
@@ -45,6 +45,10 @@
Fortran
Warn about implicit conversion
+Wfatal-errors
+Fortran RejectNegative
+Error message becomes fatal
+
Wimplicit-interface
Fortran
Warn about calls with implicit interface
Index: invoke.texi
===================================================================
--- invoke.texi (revision 106278)
+++ invoke.texi (working copy)
@@ -126,10 +126,9 @@
@xref{Warning Options,,Options to Request or Suppress Warnings}.
@gccoptlist{
-fsyntax-only -pedantic -pedantic-errors @gol
--w -Wall -Waliasing -Wconversion @gol
+-w -Wall -Waliasing -Wconversion -Wfatal-errors @gol
-Wimplicit-interface -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
--Wunused-labels -Wline-truncation @gol
--Werror -W}
+-Wunused-labels -Wline-truncation -W}
@item Debugging Options
@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
@@ -382,6 +381,12 @@
Warn about implicit conversions between different types.
+@cindex -Wfatal-errors option
+@item -Wfatal-errors
+@cindex fatal errors
+The first encountered error will be fatal. Warnings are ignored.
+
+
@cindex -Wimplicit-interface option
@cindex options, -Wimplicit-interface
@item -Wimplicit-interface
@@ -722,7 +727,6 @@
In the future this may also include other forms of checking, eg. checking
substring references.
-
@cindex -fmax-stack-var-size option
@item -fmax-stack-var-size=@var{n}
This option specifies the size in bytes of the largest array that will be put
Index: options.c
===================================================================
--- options.c (revision 106278)
+++ options.c (working copy)
@@ -52,6 +52,7 @@
gfc_option.warn_aliasing = 0;
gfc_option.warn_conversion = 0;
+ gfc_option.warn_fatal_errors = 0;
gfc_option.warn_implicit_interface = 0;
gfc_option.warn_line_truncation = 0;
gfc_option.warn_underflow = 1;
@@ -234,6 +235,10 @@
if (!gfc_option.flag_automatic)
gfc_option.flag_max_stack_var_size = 0;
+ /* Inhibit warnings if -Wfatal-error is given and -Werror is not. */
+ if (gfc_option.warn_fatal_errors)
+ inhibit_warnings = 1;
+
return false;
}
@@ -350,6 +355,10 @@
gfc_option.warn_conversion = value;
break;
+ case OPT_Wfatal_errors:
+ gfc_option.warn_fatal_errors = 1;
+ break;
+
case OPT_Wimplicit_interface:
gfc_option.warn_implicit_interface = value;
break;
More information about the Fortran
mailing list