This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] Add option to make 1st error fatal


Isn't there some (probably) unwritten rule that -ffoo is reserved for
flags that influence code generation, like optimizations and such?

Vaclav Haisman


Steve Kargl wrote:
> The attached patch has been bootstrapped and regression
> tested on i386-*-freebsd.
> 
> What does it do?  Consider the source in PR fortran/23538.
> This code will cause gfortran to go into an infinite loop,
> which isn't too unexpected in that that code is F66.  However,
> to try to debug the codei and/or gfortran, one see 438 error
> messages fly by the screen.  Many of these errors are simply
> cascaded from an earlier error are somewhat bogus.  This 
> patch disables the output of warnings and the first encountered
> error is fatal.  For example, instead of 438 errors, I now get
> 
> kargl[213] gfc41 -c -ffatal pr23538.f 
>  In file pr23538.f:308
> 
>    37 format(*0absolute addresses of first,nbaxo + nelpaz in elpa*3o21) 
>              1
> Error: Unexpected element in format string at (1)
> 
> 
> OK for mainline?
> 
> 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.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: gfortran.h
> ===================================================================
> --- gfortran.h	(revision 106248)
> +++ gfortran.h	(working copy)
> @@ -1472,6 +1472,7 @@
>    int flag_pack_derived;
>    int flag_repack_arrays;
>    int flag_f2c;
> +  int flag_fatal;
>    int flag_automatic;
>    int flag_backslash;
>    int flag_cray_pointer;
> Index: error.c
> ===================================================================
> --- error.c	(revision 106248)
> +++ 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.flag_fatal)
> +	exit (1);
>      }
>  
>    return rc;
> Index: lang.opt
> ===================================================================
> --- lang.opt	(revision 106248)
> +++ lang.opt	(working copy)
> @@ -109,6 +109,10 @@
>  Fortran
>  Use f2c calling convention
>  
> +ffatal
> +Fortran RejectNegative
> +Error messages are fatal
> +
>  ffixed-form
>  Fortran
>  Assume that the source file is fixed form
> Index: invoke.texi
> ===================================================================
> --- invoke.texi	(revision 106248)
> +++ invoke.texi	(working copy)
> @@ -134,7 +134,7 @@
>  @item Debugging Options
>  @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
>  @gccoptlist{
> --fdump-parse-tree -ffpe-trap=@var{list}}
> +-fdump-parse-tree -ffatal -ffpe-trap=@var{list}}
>  
>  @item Directory Options
>  @xref{Directory Options,,Options for Directory Search}.
> @@ -723,6 +723,11 @@
>  substring references.
>  
>  
> +@cindex -ffatal option
> +@item -ffatal
> +@cindex fatal errors
> +The first encountered error will be fatal.  Warnings are ignored.
> +
>  @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 106248)
> +++ options.c	(working copy)
> @@ -75,6 +75,7 @@
>    gfc_option.flag_backslash = 1;
>    gfc_option.flag_cray_pointer = 0;
>    gfc_option.flag_d_lines = -1;
> +  gfc_option.flag_fatal = 0;
>  
>    gfc_option.q_kind = gfc_default_double_kind;
>  
> @@ -234,6 +235,10 @@
>    if (!gfc_option.flag_automatic)
>      gfc_option.flag_max_stack_var_size = 0;
>  
> +  /* Inhibit warnings if -ffatal is given.  */
> +  if (gfc_option.flag_fatal)
> +    inhibit_warnings = 1;
> +
>    return false;
>  }
>  
> @@ -402,6 +407,10 @@
>        gfc_option.verbose = value;
>        break;
>  
> +    case OPT_ffatal:
> +      gfc_option.flag_fatal = 1;
> +      break;
> +
>      case OPT_ffixed_form:
>        gfc_option.source_form = FORM_FIXED;
>        break;

Attachment: signature.asc
Description: OpenPGP digital signature


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