[PATCH] 2nd try: Speeding up delta by -Wfatal-errors

Richard Guenther rguenth@tat.physik.uni-tuebingen.de
Wed Apr 7 11:38:00 GMT 2004


Here is the second iteration of the patch.  Option name changed to
-Wfatal-errors as suggested, error interception is done in diagnostics.c

Bootstrapped on ia64 linux.


2004-04-07  Richard Guenther  <richard.guenther@uni-tuebingen.de>

        * commom.opt (Wfatal-errors): Add it.
        * diagnostic.c (flag_fatal_errors): Define it.
        (diagnostic_action_after_output): Check for flag_fatal_errors.
        * flags.h (flag_fatal_errors): Declare it.
        * opts.c (common_handle_option): Add OPT_Wfatal_errors.
        * doc/invoke.texi (Warning Options): Document -Wfatal-errors.
-------------- next part --------------
Index: gcc/common.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/common.opt,v
retrieving revision 1.24.4.1
diff -u -c -3 -p -r1.24.4.1 common.opt
*** gcc/common.opt	18 Feb 2004 00:09:04 -0000	1.24.4.1
--- gcc/common.opt	7 Apr 2004 11:18:24 -0000
*************** Wextra
*** 76,81 ****
--- 76,85 ----
  Common
  Print extra (possibly unwanted) warnings
  
+ Wfatal-errors
+ Common
+ Exit on the first error occoured
+ 
  Winline
  Common
  Warn when an inlined function cannot be inlined
Index: gcc/diagnostic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/diagnostic.c,v
retrieving revision 1.133
diff -u -c -3 -p -r1.133 diagnostic.c
*** gcc/diagnostic.c	22 Sep 2003 05:09:12 -0000	1.133
--- gcc/diagnostic.c	7 Apr 2004 11:18:24 -0000
*************** diagnostic_context *global_dc = &global_
*** 68,73 ****
--- 68,74 ----
  with preprocessed source if appropriate.\n\
  See %s for instructions.\n"
  
+ int flag_fatal_errors = 0;
  
  /* Return a malloc'd string containing MSG formatted a la printf.  The
     caller is responsible for freeing the memory.  */
*************** diagnostic_action_after_output (diagnost
*** 265,270 ****
--- 266,276 ----
      case DK_SORRY:
        if (context->abort_on_error)
  	real_abort ();
+       if (flag_fatal_errors)
+ 	{
+ 	  fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n");
+ 	  exit (FATAL_EXIT_CODE);
+ 	}
        break;
  
      case DK_ICE:
Index: gcc/flags.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flags.h,v
retrieving revision 1.127.4.1
diff -u -c -3 -p -r1.127.4.1 flags.h
*** gcc/flags.h	18 Feb 2004 00:09:04 -0000	1.127.4.1
--- gcc/flags.h	7 Apr 2004 11:18:24 -0000
*************** extern int flag_really_no_inline;
*** 406,411 ****
--- 406,415 ----
  
  extern int flag_syntax_only;
  
+ /* Nonzero if we are exiting on the first error occoured.  */
+ 
+ extern int flag_fatal_errors;
+ 
  /* Nonzero means we should save auxiliary info into a .X file.  */
  
  extern int flag_gen_aux_info;
Index: gcc/opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.51.4.3
diff -u -c -3 -p -r1.51.4.3 opts.c
*** gcc/opts.c	18 Feb 2004 00:09:04 -0000	1.51.4.3
--- gcc/opts.c	7 Apr 2004 11:18:24 -0000
*************** common_handle_option (size_t scode, cons
*** 721,726 ****
--- 721,730 ----
        set_Wextra (value);
        break;
  
+     case OPT_Wfatal_errors:
+       flag_fatal_errors = value;
+       break;
+ 
      case OPT_Winline:
        warn_inline = value;
        break;
Index: gcc/doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.390.2.22
diff -u -c -3 -p -r1.390.2.22 invoke.texi
*** gcc/doc/invoke.texi	15 Mar 2004 21:15:33 -0000	1.390.2.22
--- gcc/doc/invoke.texi	7 Apr 2004 11:18:25 -0000
*************** in the following sections.
*** 215,221 ****
  -Wconversion  -Wno-deprecated-declarations @gol
  -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
  -Werror  -Werror-implicit-function-declaration @gol
! -Wfloat-equal  -Wformat  -Wformat=2 @gol
  -Wno-format-extra-args -Wformat-nonliteral @gol
  -Wformat-security  -Wformat-y2k @gol
  -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
--- 215,221 ----
  -Wconversion  -Wno-deprecated-declarations @gol
  -Wdisabled-optimization  -Wno-div-by-zero  -Wendif-labels @gol
  -Werror  -Werror-implicit-function-declaration @gol
! -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
  -Wno-format-extra-args -Wformat-nonliteral @gol
  -Wformat-security  -Wformat-y2k @gol
  -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
*************** machines.
*** 2074,2079 ****
--- 2074,2085 ----
  @opindex Wcomment
  Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
  comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
+ 
+ @item -Wfatal-errors
+ @opindex Wfatal-errors
+ This option causes the compiler to abort compilation on the first error
+ occoured rather than trying to keep going and printing further error
+ messages.
  
  @item -Wformat
  @opindex Wformat


More information about the Gcc-patches mailing list