summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author <shinichiro.hamaji@gmail.com>2012-01-12 08:41:09 +0000
committer <shinichiro.hamaji@gmail.com>2012-01-12 08:41:09 +0000
commit73b0abc9896b047fcea2c5fe7bcb3acfae9a140e (patch)
treebef1b4dd8a37aaf40df6f5a53536b126bf9fb09c /src
parentcd026f9eab2101d83bb19fe30d5ad153f8b43efb (diff)
downloadglog-73b0abc9896b047fcea2c5fe7bcb3acfae9a140e.tar.gz
glog-73b0abc9896b047fcea2c5fe7bcb3acfae9a140e.tar.bz2
glog-73b0abc9896b047fcea2c5fe7bcb3acfae9a140e.zip
Remove trivial warnings produced by clang
git-svn-id: https://google-glog.googlecode.com/svn/trunk@107 eb4d4688-79bd-11dd-afb4-1d65580434c0
Diffstat (limited to 'src')
-rw-r--r--src/base/googleinit.h2
-rw-r--r--src/demangle.cc4
-rw-r--r--src/glog/logging.h.in2
-rw-r--r--src/googletest.h4
-rw-r--r--src/logging.cc2
-rw-r--r--src/logging_striptest_main.cc2
-rw-r--r--src/logging_unittest.cc25
-rw-r--r--src/signalhandler.cc4
-rw-r--r--src/stacktrace_unittest.cc2
-rw-r--r--src/stl_logging_unittest.cc4
-rw-r--r--src/symbolize.cc6
-rw-r--r--src/utilities.cc2
-rw-r--r--src/vlog_is_on.cc6
-rwxr-xr-xsrc/windows/glog/logging.h2
14 files changed, 34 insertions, 33 deletions
diff --git a/src/base/googleinit.h b/src/base/googleinit.h
index c907308..5a8b515 100644
--- a/src/base/googleinit.h
+++ b/src/base/googleinit.h
@@ -36,7 +36,7 @@
class GoogleInitializer {
public:
typedef void (*void_function)(void);
- GoogleInitializer(const char* name, void_function f) {
+ GoogleInitializer(const char*, void_function f) {
f();
}
};
diff --git a/src/demangle.cc b/src/demangle.cc
index 2fbb790..0daf308 100644
--- a/src/demangle.cc
+++ b/src/demangle.cc
@@ -237,7 +237,7 @@ static bool ParseCharClass(State *state, const char *char_class) {
}
// This function is used for handling an optional non-terminal.
-static bool Optional(bool status) {
+static bool Optional(bool) {
return true;
}
@@ -400,7 +400,7 @@ static void MaybeCancelLastSeparator(State *state) {
// "mangled_cur" is anonymous namespace.
static bool IdentifierIsAnonymousNamespace(State *state, int length) {
static const char anon_prefix[] = "_GLOBAL__N_";
- return (length > sizeof(anon_prefix) - 1 && // Should be longer.
+ return (length > (int)sizeof(anon_prefix) - 1 && // Should be longer.
StrPrefix(state->mangled_cur, anon_prefix));
}
diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
index f693068..d9aca8a 100644
--- a/src/glog/logging.h.in
+++ b/src/glog/logging.h.in
@@ -1485,7 +1485,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
// converted to LogStream and the message will be computed and then
// quietly discarded.
template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.
diff --git a/src/googletest.h b/src/googletest.h
index dce0c6c..b3e26c4 100644
--- a/src/googletest.h
+++ b/src/googletest.h
@@ -110,7 +110,7 @@ using testing::InitGoogleTest;
_START_GOOGLE_NAMESPACE_
-void InitGoogleTest(int* argc, char** argv) {}
+void InitGoogleTest(int*, char**) {}
// The following is some bare-bones testing infrastructure
@@ -528,7 +528,7 @@ class Thread {
public:
virtual ~Thread() {}
- void SetJoinable(bool joinable) {}
+ void SetJoinable(bool) {}
#if defined(OS_WINDOWS) || defined(OS_CYGWIN)
void Start() {
handle_ = CreateThread(NULL,
diff --git a/src/logging.cc b/src/logging.cc
index 1b864cd..b3b7703 100644
--- a/src/logging.cc
+++ b/src/logging.cc
@@ -1564,7 +1564,7 @@ static void GetTempDirectories(vector<string>* list) {
"/tmp",
};
- for (int i = 0; i < ARRAYSIZE(candidates); i++) {
+ for (size_t i = 0; i < ARRAYSIZE(candidates); i++) {
const char *d = candidates[i];
if (!d) continue; // Empty env var
diff --git a/src/logging_striptest_main.cc b/src/logging_striptest_main.cc
index 2e5d3b1..2fb9127 100644
--- a/src/logging_striptest_main.cc
+++ b/src/logging_striptest_main.cc
@@ -56,7 +56,7 @@ int CheckNoReturn(bool b) {
struct A { };
std::ostream &operator<<(std::ostream &str, const A&) {return str;}
-int main(int argc, char* argv[]) {
+int main(int, char* argv[]) {
FLAGS_logtostderr = true;
InitGoogleLogging(argv[0]);
if (FLAGS_check_mode) {
diff --git a/src/logging_unittest.cc b/src/logging_unittest.cc
index cf41583..824086c 100644
--- a/src/logging_unittest.cc
+++ b/src/logging_unittest.cc
@@ -155,7 +155,8 @@ static void BM_Check2(int n) {
}
BENCHMARK(BM_Check2);
-static void CheckFailure(int a, int b, const char* file, int line, const char* msg) {
+static void CheckFailure(int, int, const char* /* file */, int /* line */,
+ const char* /* msg */) {
}
static void BM_logspeed(int n) {
@@ -471,7 +472,7 @@ void TestLogToString() {
class TestLogSinkImpl : public LogSink {
public:
vector<string> errors;
- virtual void send(LogSeverity severity, const char* full_filename,
+ virtual void send(LogSeverity severity, const char* /* full_filename */,
const char* base_filename, int line,
const struct tm* tm_time,
const char* message, size_t message_len) {
@@ -610,7 +611,7 @@ static void GetFiles(const string& pattern, vector<string>* files) {
glob_t g;
const int r = glob(pattern.c_str(), 0, NULL, &g);
CHECK((r == 0) || (r == GLOB_NOMATCH)) << ": error matching " << pattern;
- for (int i = 0; i < g.gl_pathc; i++) {
+ for (size_t i = 0; i < g.gl_pathc; i++) {
files->push_back(string(g.gl_pathv[i]));
}
globfree(&g);
@@ -647,7 +648,7 @@ static void DeleteFiles(const string& pattern) {
static void CheckFile(const string& name, const string& expected_string) {
vector<string> files;
GetFiles(name + "*", &files);
- CHECK_EQ(files.size(), 1);
+ CHECK_EQ(files.size(), 1UL);
FILE* file = fopen(files[0].c_str(), "r");
CHECK(file != NULL) << ": could not open " << files[0];
@@ -711,7 +712,7 @@ static void TestExtension() {
// Check that file name ends with extension
vector<string> filenames;
GetFiles(dest + "*", &filenames);
- CHECK_EQ(filenames.size(), 1);
+ CHECK_EQ(filenames.size(), 1UL);
CHECK(strstr(filenames[0].c_str(), "specialextension") != NULL);
// Release file handle for the destination file to unlock the file in Windows.
@@ -722,8 +723,8 @@ static void TestExtension() {
struct MyLogger : public base::Logger {
string data;
- virtual void Write(bool should_flush,
- time_t timestamp,
+ virtual void Write(bool /* should_flush */,
+ time_t /* timestamp */,
const char* message,
int length) {
data.append(message, length);
@@ -991,7 +992,7 @@ class TestWaitingLogSink : public LogSink {
// (re)define LogSink interface
- virtual void send(LogSeverity severity, const char* full_filename,
+ virtual void send(LogSeverity severity, const char* /* full_filename */,
const char* base_filename, int line,
const struct tm* tm_time,
const char* message, size_t message_len) {
@@ -1030,7 +1031,7 @@ static void TestLogSinkWaitTillSent() {
for (size_t i = 0; i < global_messages.size(); ++i) {
LOG(INFO) << "Sink capture: " << global_messages[i];
}
- CHECK_EQ(global_messages.size(), 3);
+ CHECK_EQ(global_messages.size(), 3UL);
}
TEST(Strerror, logging) {
@@ -1190,10 +1191,10 @@ TEST(LogBacktraceAt, DoesBacktraceAtRightLineWhenEnabled) {
#endif // HAVE_LIB_GMOCK
struct UserDefinedClass {
- bool operator==(const UserDefinedClass& rhs) const { return true; }
+ bool operator==(const UserDefinedClass&) const { return true; }
};
-inline ostream& operator<<(ostream& out, const UserDefinedClass& u) {
+inline ostream& operator<<(ostream& out, const UserDefinedClass&) {
out << "OK";
return out;
}
@@ -1202,7 +1203,7 @@ TEST(UserDefinedClass, logging) {
UserDefinedClass u;
vector<string> buf;
LOG_STRING(INFO, &buf) << u;
- CHECK_EQ(1, buf.size());
+ CHECK_EQ(1UL, buf.size());
CHECK(buf[0].find("OK") != string::npos);
// We must be able to compile this.
diff --git a/src/signalhandler.cc b/src/signalhandler.cc
index 7c8fe57..d6c203b 100644
--- a/src/signalhandler.cc
+++ b/src/signalhandler.cc
@@ -169,7 +169,7 @@ void DumpTimeInfo() {
void DumpSignalInfo(int signal_number, siginfo_t *siginfo) {
// Get the signal name.
const char* signal_name = NULL;
- for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
if (signal_number == kFailureSignals[i].number) {
signal_name = kFailureSignals[i].name;
}
@@ -338,7 +338,7 @@ void InstallFailureSignalHandler() {
sig_action.sa_flags |= SA_SIGINFO;
sig_action.sa_sigaction = &FailureSignalHandler;
- for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+ for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
CHECK_ERR(sigaction(kFailureSignals[i].number, &sig_action, NULL));
}
}
diff --git a/src/stacktrace_unittest.cc b/src/stacktrace_unittest.cc
index 7504e19..c1b3b36 100644
--- a/src/stacktrace_unittest.cc
+++ b/src/stacktrace_unittest.cc
@@ -190,7 +190,7 @@ void ATTRIBUTE_NOINLINE CheckStackTrace(int i) {
//-----------------------------------------------------------------------//
-int main(int argc, char ** argv) {
+int main(int, char ** argv) {
FLAGS_logtostderr = true;
InitGoogleLogging(argv[0]);
diff --git a/src/stl_logging_unittest.cc b/src/stl_logging_unittest.cc
index 021f642..f932e95 100644
--- a/src/stl_logging_unittest.cc
+++ b/src/stl_logging_unittest.cc
@@ -170,7 +170,7 @@ void TestSTLLogging() {
#endif
}
-int main(int argc, char** argv) {
+int main(int, char**) {
TestSTLLogging();
std::cout << "PASS\n";
return 0;
@@ -180,7 +180,7 @@ int main(int argc, char** argv) {
#include <iostream>
-int main(int argc, char** argv) {
+int main(int, char**) {
std::cout << "We don't support stl_logging for this compiler.\n"
<< "(we need compiler support of 'using ::operator<<' "
<< "for this feature.)\n";
diff --git a/src/symbolize.cc b/src/symbolize.cc
index 3465de6..b69eefd 100644
--- a/src/symbolize.cc
+++ b/src/symbolize.cc
@@ -82,8 +82,8 @@ static ATTRIBUTE_NOINLINE void DemangleInplace(char *out, int out_size) {
char demangled[256]; // Big enough for sane demangled symbols.
if (Demangle(out, demangled, sizeof(demangled))) {
// Demangling succeeded. Copy to out if the space allows.
- int len = strlen(demangled);
- if (len + 1 <= out_size) { // +1 for '\0'.
+ size_t len = strlen(demangled);
+ if (len + 1 <= (size_t)out_size) { // +1 for '\0'.
SAFE_ASSERT(len < sizeof(demangled));
memmove(out, demangled, len + 1);
}
@@ -637,7 +637,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
int out_size) {
Dl_info info;
if (dladdr(pc, &info)) {
- if (strlen(info.dli_sname) < out_size) {
+ if ((int)strlen(info.dli_sname) < out_size) {
strcpy(out, info.dli_sname);
// Symbolization succeeded. Now we try to demangle the symbol.
DemangleInplace(out, out_size);
diff --git a/src/utilities.cc b/src/utilities.cc
index 52b802a..27b2a90 100644
--- a/src/utilities.cc
+++ b/src/utilities.cc
@@ -77,7 +77,7 @@ typedef void DebugWriter(const char*, void*);
// For some environments, add two extra bytes for the leading "0x".
static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*);
-static void DebugWriteToStderr(const char* data, void *unused) {
+static void DebugWriteToStderr(const char* data, void *) {
// This one is signal-safe.
if (write(STDERR_FILENO, data, strlen(data)) < 0) {
// Ignore errors.
diff --git a/src/vlog_is_on.cc b/src/vlog_is_on.cc
index ee0e412..8a79df5 100644
--- a/src/vlog_is_on.cc
+++ b/src/vlog_is_on.cc
@@ -70,8 +70,8 @@ GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
size_t patt_len,
const char* str,
size_t str_len) {
- int p = 0;
- int s = 0;
+ size_t p = 0;
+ size_t s = 0;
while (1) {
if (p == patt_len && s == str_len) return true;
if (p == patt_len) return false;
@@ -211,7 +211,7 @@ bool InitVLOG3__(int32** site_flag, int32* site_default,
const char* base = strrchr(fname, '/');
base = base ? (base+1) : fname;
const char* base_end = strchr(base, '.');
- size_t base_length = base_end ? (base_end - base) : strlen(base);
+ size_t base_length = base_end ? size_t(base_end - base) : strlen(base);
// Trim out trailing "-inl" if any
if (base_length >= 4 && (memcmp(base+base_length-4, "-inl", 4) == 0)) {
diff --git a/src/windows/glog/logging.h b/src/windows/glog/logging.h
index b22e791..f854a06 100755
--- a/src/windows/glog/logging.h
+++ b/src/windows/glog/logging.h
@@ -1489,7 +1489,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
// converted to LogStream and the message will be computed and then
// quietly discarded.
template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
// Similar to NullStream, but aborts the program (without stack
// trace), like LogMessageFatal.