aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2008-05-06 18:32:38 +0000
committerIan Lance Taylor <ian@airs.com>2008-05-06 18:32:38 +0000
commitd82a5bcc8556860bf686ba6bc80a07757e334c7a (patch)
treed07d04e045397b3c9e1455b25614da3a055bf2cf /gold
parentf1f70eae2856e8a0aae42d74829cedcb02b9801b (diff)
downloadgdb-d82a5bcc8556860bf686ba6bc80a07757e334c7a.zip
gdb-d82a5bcc8556860bf686ba6bc80a07757e334c7a.tar.gz
gdb-d82a5bcc8556860bf686ba6bc80a07757e334c7a.tar.bz2
* options.h (class General_options): Add --fatal-warnings.
* main.cc (main): Implement --fatal-warnings. * errors.h (Errors::warning_count): New function.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog4
-rw-r--r--gold/errors.h5
-rw-r--r--gold/main.cc5
-rw-r--r--gold/options.h4
4 files changed, 18 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 358ec64..3f77ed4 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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.
diff --git a/gold/errors.h b/gold/errors.h
index bc77994..b373a06 100644
--- a/gold/errors.h
+++ b/gold/errors.h
@@ -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&);
diff --git a/gold/main.cc b/gold/main.cc
index 9b6ded0..c785da2 100644
--- a/gold/main.cc
+++ b/gold/main.cc
@@ -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
diff --git a/gold/options.h b/gold/options.h
index 9eb51ce..2ea57ec 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -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"));