diff options
author | Nicolas Despres <nicolas.despres@gmail.com> | 2011-05-01 15:31:50 (GMT) |
---|---|---|
committer | Nicolas Despres <nicolas.despres@gmail.com> | 2011-05-02 14:53:54 (GMT) |
commit | 6da4913d81b83e1c011d0be285df0c18ab0d7856 (patch) | |
tree | 81539343eb8372cf747858d7db424a2f12c67c8f | |
parent | 23a7aa78bf2a8fffc27eec74e928c6681d11f094 (diff) | |
download | Ninja-6da4913d81b83e1c011d0be285df0c18ab0d7856.zip Ninja-6da4913d81b83e1c011d0be285df0c18ab0d7856.tar.gz Ninja-6da4913d81b83e1c011d0be285df0c18ab0d7856.tar.bz2 |
Add a Warning() report function.
Also fix sites where Error() was misused.
-rw-r--r-- | src/ninja_jumble.cc | 4 | ||||
-rw-r--r-- | src/util.cc | 9 | ||||
-rw-r--r-- | src/util.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/ninja_jumble.cc b/src/ninja_jumble.cc index e33fa32..9ee6766 100644 --- a/src/ninja_jumble.cc +++ b/src/ninja_jumble.cc @@ -177,8 +177,8 @@ void State::AddOut(Edge* edge, const string& path) { Node* node = GetNode(path); edge->outputs_.push_back(node); if (node->in_edge_) { - Error("WARNING: multiple rules generate %s. " - "build will not be correct; continuing anyway", path.c_str()); + Warning("multiple rules generate %s. " + "build will not be correct; continuing anyway", path.c_str()); } node->in_edge_ = edge; } diff --git a/src/util.cc b/src/util.cc index 9d13ca3..c37882f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -37,6 +37,15 @@ void Fatal(const char* msg, ...) { exit(1); } +void Warning(const char* msg, ...) { + va_list ap; + fprintf(stderr, "ninja: WARNING: "); + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + void Error(const char* msg, ...) { va_list ap; fprintf(stderr, "ninja: error: "); @@ -22,6 +22,9 @@ using namespace std; /// Log a fatal message and exit. void Fatal(const char* msg, ...); +/// Log a warning message. +void Warning(const char* msg, ...); + /// Log an error message. void Error(const char* msg, ...); |