Remove trivial warnings produced by clang
git-svn-id: https://google-glog.googlecode.com/svn/trunk@107 eb4d4688-79bd-11dd-afb4-1d65580434c0
This commit is contained in:
parent
cd026f9eab
commit
73b0abc989
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -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]);
|
||||
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)) {
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user