This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/fortran] Add option to make 1st error fatal
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: sgk at troutmask dot apl dot washington dot edu (Steve Kargl)
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sun, 30 Oct 2005 22:55:00 -0500 (EST)
- Subject: Re: [PATCH/fortran] Add option to make 1st error fatal
> Here's a new patch based on feedback from Andrew Pinski on IRC.
> Bubblestrap and regression tested on i386-*-freebsd.
-Werror does not do what option does. It just changes warnings
to be considered an error for the return value.
And you really don't need to document these options as they are
generic options.
> --k1lZvvs/B4yU6o8G
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename="fatal1.diff"
>
> Index: gfortran.h
> ===================================================================
> --- gfortran.h (revision 106266)
> +++ gfortran.h (working copy)
> @@ -1453,6 +1453,8 @@
>
> int warn_aliasing;
> int warn_conversion;
> + int warn_error;
> + int warn_fatal_errors;
> int warn_implicit_interface;
> int warn_line_truncation;
> int warn_underflow;
You don't need as the common part of GCC already have
a variable for each of these.
> Index: error.c
> ===================================================================
> --- error.c (revision 106266)
> +++ error.c (working copy)
> @@ -480,6 +480,9 @@
> va_end (argp);
>
> error_char ('\0');
> +
> + if (gfc_option.warn_error)
> + exit (1);
This really should be:
if (warnings_are_errors)
errors++;
> }
>
>
> @@ -571,6 +574,9 @@
> if (warning_buffer.message != NULL)
> fputs (warning_buffer.message, stderr);
> warning_buffer.flag = 0;
> +
> + if (gfc_option.warn_error)
> + exit (1);
> }
> }
Likewise.
Oh, maybe you should check on flag_fatal_errors too.
>
> @@ -687,6 +693,9 @@
> if (error_buffer.message != NULL)
> fputs (error_buffer.message, stderr);
> error_buffer.flag = 0;
> +
> + if (gfc_option.warn_fatal_errors)
> + exit (1);
> }
This should be:
if (flag_fatal_errors)
exit (1);
>
> return rc;
> Index: lang.opt
> ===================================================================
> --- lang.opt (revision 106266)
> +++ lang.opt (working copy)
> @@ -45,6 +45,14 @@
> Fortran
> Warn about implicit conversion
>
> +Werror
> +Fortran
> +Warning message becomes fatal
> +
> +Wfatal-errors
> +Fortran RejectNegative
> +Error message becomes fatal
> +
> Wimplicit-interface
> Fortran
> Warn about calls with implicit interface
You should not need those.
> Index: invoke.texi
> ===================================================================
> --- invoke.texi (revision 106266)
> +++ invoke.texi (working copy)
> @@ -126,7 +126,7 @@
> @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 -Werror -Wfatal-errors @gol
> -Wimplicit-interface -Wnonstd-intrinsics -Wsurprising -Wunderflow @gol
> -Wunused-labels -Wline-truncation @gol
> -Werror -W}
> @@ -382,6 +382,20 @@
> Warn about implicit conversions between different types.
>
>
> +@cindex -Werror option
> +@item -Werror
> +@cindex fatal warnings
> +The first encountered warning will be fatal. This option
> +should be used with discretion with legacy code.
No, -Werror does not mean that. It means:
Treat all warnings as errors
> +
> +
> +@cindex -Wfatal-errors option
> +@item -Wfatal-errors
> +@cindex fatal errors
> +The first encountered error will be fatal. If the -Werror option
> +is used, warnings are ignored.
> +
Maybe you don't need a comment about warnings but maybe you should
read the docs for the common part of invoke.texi.
> + if (gfc_option.warn_fatal_errors && !gfc_option.warn_error)
> + inhibit_warnings = 1;
Why do you need to inhibit warnings anyways?
Thanks,
Andrew Pinski