summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-30 05:29:23 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>2004-04-30 05:29:23 +0000
commit295acf4f5ca177d3b8d9fb631b463e4011378197 (patch)
tree6a6d9a948a86807f77ca3ea4ba0484743388b9e7
parent5024a4f824b5e13f75592bf62c8456f736c34c57 (diff)
downloadgcc-295acf4f5ca177d3b8d9fb631b463e4011378197.tar.gz
Patch from Richard Guenther.
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81323 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/common.opt4
-rw-r--r--gcc/diagnostic.c6
-rw-r--r--gcc/doc/invoke.texi8
-rw-r--r--gcc/flags.h4
-rw-r--r--gcc/opts.c4
6 files changed, 34 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3e998c8789b..7460ff7fc09 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2004-04-29 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.
+
2004-04-30 Josef Zlomek <zlomekj@suse.cz>
* gcse.c (remove_reachable_equiv_notes): Delete notes also in
diff --git a/gcc/common.opt b/gcc/common.opt
index d7bed08d4ae..92748d33062 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -76,6 +76,10 @@ Wextra
Common
Print extra (possibly unwanted) warnings
+Wfatal-errors
+Common
+Exit on the first error occurred
+
Winline
Common
Warn when an inlined function cannot be inlined
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index b495d6451c3..16afddc1b4b 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -67,6 +67,7 @@ diagnostic_context *global_dc = &global_diagnostic_context;
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. */
@@ -264,6 +265,11 @@ diagnostic_action_after_output (diagnostic_context *context,
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:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 7cba693f4c6..6161c1811ba 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -214,7 +214,7 @@ in the following sections.
-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
+-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
@@ -2065,6 +2065,12 @@ machines.
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
+occurred rather than trying to keep going and printing further error
+messages.
+
@item -Wformat
@opindex Wformat
Check calls to @code{printf} and @code{scanf}, etc., to make sure that
diff --git a/gcc/flags.h b/gcc/flags.h
index 472df5426d6..b4fc10d7f90 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -407,6 +407,10 @@ extern int flag_really_no_inline;
extern int flag_syntax_only;
extern int rtl_dump_and_exit;
+/* Nonzero if we are exiting on the first error occurred. */
+
+extern int flag_fatal_errors;
+
/* Nonzero means we should save auxiliary info into a .X file. */
extern int flag_gen_aux_info;
diff --git a/gcc/opts.c b/gcc/opts.c
index fb04b8fbb41..b0ede80e610 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -742,6 +742,10 @@ common_handle_option (size_t scode, const char *arg,
set_Wextra (value);
break;
+ case OPT_Wfatal_errors:
+ flag_fatal_errors = value;
+ break;
+
case OPT_Winline:
warn_inline = value;
break;