This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

PATCH COMMITTED: Implement --fatal-warnings


"Andreas Hartmetz" <ahartmetz@gmail.com> writes:

> + || !strcmp(argv[i], "--fatal-warnings")) //### ignore, don't fail

I have committed this patch to implement --fatal-warnings in gold.

Ian


2008-05-06  Ian Lance Taylor  <iant@google.com>

	* options.h (class General_options): Add --fatal-warnings.
	* main.cc (main): Implement --fatal-warnings.
	* errors.h (Errors::warning_count): New function.


Index: errors.h
===================================================================
RCS file: /cvs/src/src/gold/errors.h,v
retrieving revision 1.5
diff -p -u -r1.5 errors.h
--- errors.h	17 Apr 2008 22:45:47 -0000	1.5
+++ errors.h	6 May 2008 18:31:11 -0000
@@ -93,6 +93,11 @@ class Errors
   error_count() const
   { return this->error_count_; }
 
+  // Return the number of warnings.
+  int
+  warning_count() const
+  { return this->warning_count_; }
+
  private:
   Errors(const Errors&);
   Errors& operator=(const Errors&);
Index: main.cc
===================================================================
RCS file: /cvs/src/src/gold/main.cc,v
retrieving revision 1.23
diff -p -u -r1.23 main.cc
--- main.cc	9 Apr 2008 01:19:09 -0000	1.23
+++ main.cc	6 May 2008 18:31:11 -0000
@@ -220,6 +220,11 @@ main(int argc, char** argv)
       layout.print_stats();
     }
 
+  if (parameters->options().fatal_warnings()
+      && errors.warning_count() > 0
+      && errors.error_count() == 0)
+    gold_error("treating warnings as errors");
+
   // If the user used --noinhibit-exec, we force the exit status to be
   // successful.  This is compatible with GNU ld.
   gold_exit(errors.error_count() == 0
Index: options.h
===================================================================
RCS file: /cvs/src/src/gold/options.h,v
retrieving revision 1.74
diff -p -u -r1.74 options.h
--- options.h	6 May 2008 17:46:31 -0000	1.74
+++ options.h	6 May 2008 18:31:11 -0000
@@ -565,6 +565,10 @@ class General_options
   DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
               N_("Create exception frame header"), NULL);
 
+  DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
+	      N_("Treat warnings as errors"),
+	      N_("Do not treat warnings as errors"));
+
   DEFINE_string(soname, options::ONE_DASH, 'h', NULL,
                 N_("Set shared library name"), N_("FILENAME"));
 

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