* options.h (class General_options): Add --fatal-warnings.
authorIan Lance Taylor <ian@airs.com>
Tue, 6 May 2008 18:32:38 +0000 (18:32 +0000)
committerIan Lance Taylor <ian@airs.com>
Tue, 6 May 2008 18:32:38 +0000 (18:32 +0000)
* main.cc (main): Implement --fatal-warnings.
* errors.h (Errors::warning_count): New function.

gold/ChangeLog
gold/errors.h
gold/main.cc
gold/options.h

index 358ec64bfb447d1bd09e71a80933920728ee662b..3f77ed430784aad1bfea3808a47e3edba467df60 100644 (file)
@@ -1,5 +1,9 @@
 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.
+
        * options.h (class General_options): Add -Bsymbolic-functions.
        * symtab.h (Symbol::is_preemptible): Check for
        -Bsymbolic-functions.
index bc779945382cd9a5d6ea8fc9e5fedc8debe8e794..b373a06a4f7236f806b173d98ae5d78ddab82d8d 100644 (file)
@@ -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 9b6ded0810b39594fd825e45d17c133106359151..c785da231eea51e376004df23c591d0f6f47b0fa 100644 (file)
@@ -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 9eb51ce032eb739bb3f9608789c031c24d47ff3d..2ea57ecb01bac4983da56dd552fda5edaa1a9990 100644 (file)
@@ -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"));
 
This page took 0.030707 seconds and 4 git commands to generate.