summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-11-20 00:19:10 (GMT)
committerEvan Martin <martine@danga.com>2011-11-20 00:19:10 (GMT)
commit73023f63f1539af51b3bbfc9d7233bc88bfe9b77 (patch)
tree2d00be1a8ddbbc48bb7a2b747d5ba64abed6e638
parent68c5917bf994d7e32b30a5b6df4bbda0189a4017 (diff)
parentccdef45a2a5af30f897c107062e5939c3be4371f (diff)
downloadNinja-73023f63f1539af51b3bbfc9d7233bc88bfe9b77.zip
Ninja-73023f63f1539af51b3bbfc9d7233bc88bfe9b77.tar.gz
Ninja-73023f63f1539af51b3bbfc9d7233bc88bfe9b77.tar.bz2
Merge pull request #136 from polrop/add-extra-warning
Add -Wextra compilation flags
-rwxr-xr-xconfigure.py2
-rw-r--r--src/browse.cc2
-rw-r--r--src/build.cc4
-rw-r--r--src/eval_env.h2
-rw-r--r--src/ninja.cc8
-rw-r--r--src/subprocess-win32.cc2
-rw-r--r--src/subprocess.cc2
-rw-r--r--src/util.cc3
-rw-r--r--src/util.h2
9 files changed, 18 insertions, 9 deletions
diff --git a/configure.py b/configure.py
index 16db729..e31387e 100755
--- a/configure.py
+++ b/configure.py
@@ -74,7 +74,7 @@ def cxx(name, **kwargs):
n.variable('builddir', 'build')
-cflags = ['-g', '-Wall', '-Wno-deprecated', '-fno-exceptions',
+cflags = ['-g', '-Wall', '-Wextra', '-Wno-deprecated', '-fno-exceptions',
'-fvisibility=hidden', '-pipe']
if not options.debug:
cflags += ['-O2', '-DNDEBUG']
diff --git a/src/browse.cc b/src/browse.cc
index bab3f36..2e74206 100644
--- a/src/browse.cc
+++ b/src/browse.cc
@@ -20,7 +20,7 @@
#include "../build/browse_py.h"
-void RunBrowsePython(State* state, const char* ninja_command,
+void RunBrowsePython(State* /* state */, const char* ninja_command,
const char* initial_target) {
// Fork off a Python process and have it run our code via its stdin.
// (Actually the Python process becomes the parent.)
diff --git a/src/build.cc b/src/build.cc
index 9465532..1686eed 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -163,6 +163,8 @@ void BuildStatus::PrintStatus(Edge* edge) {
}
}
}
+#else
+ NINJA_UNUSED_ARG(progress_chars);
#endif
printf("%s", to_print.c_str());
@@ -419,7 +421,7 @@ struct DryRunCommandRunner : public CommandRunner {
finished_.push(edge);
return true;
}
- virtual Edge* WaitForCommand(bool* success, string* output) {
+ virtual Edge* WaitForCommand(bool* success, string* /* output */) {
if (finished_.empty())
return NULL;
*success = true;
diff --git a/src/eval_env.h b/src/eval_env.h
index 37f7b07..ed7c2f4 100644
--- a/src/eval_env.h
+++ b/src/eval_env.h
@@ -45,7 +45,7 @@ struct EvalString {
string Evaluate(Env* env) const;
const string& unparsed() const { return unparsed_; }
- const bool empty() const { return unparsed_.empty(); }
+ bool empty() const { return unparsed_.empty(); }
string unparsed_;
enum TokenType { RAW, SPECIAL };
diff --git a/src/ninja.cc b/src/ninja.cc
index 9c0a90f..8125c98 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -247,6 +247,10 @@ int CmdBrowse(State* state, const char* ninja_command,
}
RunBrowsePython(state, ninja_command, argv[0]);
#else
+ NINJA_UNUSED_ARG(state);
+ NINJA_UNUSED_ARG(ninja_command);
+ NINJA_UNUSED_ARG(argc);
+ NINJA_UNUSED_ARG(argv);
Error("browse mode not yet supported on Windows");
#endif
// If we get here, the browse failed.
@@ -363,7 +367,7 @@ int CmdTargets(State* state, int argc, char* argv[]) {
}
}
-int CmdRules(State* state, int argc, char* argv[]) {
+int CmdRules(State* state, int /* argc */, char* /* argv */[]) {
for (map<string, const Rule*>::iterator i = state->rules_.begin();
i != state->rules_.end(); ++i) {
if (i->second->description_.unparsed_.empty()) {
@@ -459,7 +463,7 @@ int main(int argc, char** argv) {
const option kLongOptions[] = {
{ "help", no_argument, NULL, 'h' },
- { }
+ { NULL, 0, NULL, 0 }
};
int opt;
diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc
index 6e5ebab..f331337 100644
--- a/src/subprocess-win32.cc
+++ b/src/subprocess-win32.cc
@@ -90,7 +90,7 @@ HANDLE Subprocess::SetupPipe(HANDLE ioport) {
bool Subprocess::Start(SubprocessSet* set, const string& command) {
HANDLE child_pipe = SetupPipe(set->ioport_);
- STARTUPINFOA startup_info = {};
+ STARTUPINFOA startup_info;
startup_info.cb = sizeof(STARTUPINFO);
startup_info.dwFlags = STARTF_USESTDHANDLES;
startup_info.hStdOutput = child_pipe;
diff --git a/src/subprocess.cc b/src/subprocess.cc
index 74eded0..da93b1f 100644
--- a/src/subprocess.cc
+++ b/src/subprocess.cc
@@ -37,7 +37,7 @@ Subprocess::~Subprocess() {
Finish();
}
-bool Subprocess::Start(SubprocessSet* set, const string& command) {
+bool Subprocess::Start(SubprocessSet* /* set */, const string& command) {
int output_pipe[2];
if (pipe(output_pipe) < 0)
Fatal("pipe: %s", strerror(errno));
diff --git a/src/util.cc b/src/util.cc
index 0bbcaf2..e8cd11e 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -173,7 +173,8 @@ void SetCloseOnExec(int fd) {
#else
// On Windows, handles must be explicitly marked to be passed to a
// spawned process, so there's nothing to do here.
-#endif // WIN32
+ NINJA_UNUSED_ARG(fd);
+#endif // ! _WIN32
}
int64_t GetTimeMillis() {
diff --git a/src/util.h b/src/util.h
index 40b519e..d36e2e1 100644
--- a/src/util.h
+++ b/src/util.h
@@ -21,6 +21,8 @@
#include <string>
using namespace std;
+#define NINJA_UNUSED_ARG(arg_name) (void)arg_name;
+
/// Log a fatal message and exit.
void Fatal(const char* msg, ...);