This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Add -fmax-errors option to limit the number of errors emitted.
- From: Bernhard Fischer <rep dot nop at aon dot at>
- To: Brooks Moses <brooks dot moses at codesourcery dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 8 Nov 2006 09:18:50 +0100
- Subject: Re: [patch, fortran] Add -fmax-errors option to limit the number of errors emitted.
- References: <4550FAB9.2000502@codesourcery.com>
On Tue, Nov 07, 2006 at 01:29:29PM -0800, Brooks Moses wrote:
>PR 23538 mentions the utility of having an option that causes gfortran
>to give up and quit after emitting a certain number of errors. The
>following patch implements this.
>
>-----------------------------------------------------------------
>2006-11-07 Brooks Moses <brooks.moses@codesourcery.com>
>
> * lang.opt: Add -fmax-errors= option.
> * gfortran.h (gfc_option_t): Add max_errors element.
> * options.c (gfc_init_options): Set max_errors default value
> to 50.
> (gfc_handle_options): Check -fmax_errors value, assign to
> gfc_option.max_errors.
> * error.c (gfc_increment_error_count): New function, which
> also checks whether the error count exceeds max_errors.
> (gfc_warning): Use it.
> (gfc_notify_std): Use it.
> (gfc_warning_now): Use it.
> (gfc_error): Use it.
> (gfc_error_now): Use it.
> (gfc_error_check): Use it.
> (gfc_warning): Use it.
>-----------------------------------------------------------------
>
>Regtested on i686-pc-linux-gnu. Ok for trunk?
>
>(Once this is approved, I'll submit a corresponding documentation update.)
>
>- Brooks
>Index: lang.opt
>===================================================================
>--- lang.opt (revision 118541)
>+++ lang.opt (working copy)
>@@ -169,6 +169,10 @@
> Fortran RejectNegative Joined UInteger
> -ffree-line-length-<n> Use n as character line width in free mode
>
>+fmax-errors=
>+Fortran RejectNegative Joined UInteger
>+-fmax-errors=<n> Maximum number of errors to report
>+
> fmax-identifier-length=
> Fortran RejectNegative Joined UInteger
> -fmax-identifier-length=<n> Maximum identifier length
>Index: gfortran.h
>===================================================================
>--- gfortran.h (revision 118541)
>+++ gfortran.h (working copy)
>@@ -1629,6 +1629,7 @@
> int warn_surprising;
> int warn_tabs;
> int warn_underflow;
>+ int max_errors;
>
> int flag_all_intrinsics;
> int flag_default_double;
>Index: options.c
>===================================================================
>--- options.c (revision 118541)
>+++ options.c (working copy)
>@@ -61,6 +61,7 @@
> gfc_option.warn_surprising = 0;
> gfc_option.warn_tabs = 1;
> gfc_option.warn_underflow = 1;
>+ gfc_option.max_errors = 50;
>
> gfc_option.flag_all_intrinsics = 0;
> gfc_option.flag_default_double = 0;
>@@ -514,6 +515,12 @@
> gfc_option.flag_implicit_none = value;
> break;
>
>+ case OPT_fmax_errors_:
->+ if (value < 0)
Due to RejectNegative this can never happen.
->+ gfc_fatal_error ("The -fmax_error value cannot be less than zero.");
>+ gfc_option.max_errors = value;
>+ break;
>+
> case OPT_fmax_stack_var_size_:
> gfc_option.flag_max_stack_var_size = value;
> break;