Skip to content

Commit 5c8c279

Browse files
authored
Merge pull request google#302 from Nazg-Gul/missing-prototype
Resolve missing prototype warning
2 parents 070eb9d + 1603a51 commit 5c8c279

File tree

10 files changed

+32
-20
lines changed

10 files changed

+32
-20
lines changed

src/googletest.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ using testing::InitGoogleTest;
110110

111111
_START_GOOGLE_NAMESPACE_
112112

113+
void InitGoogleTest(int*, char**);
114+
113115
void InitGoogleTest(int*, char**) {}
114116

115117
// The following is some bare-bones testing infrastructure

src/logging.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ static GLogColor SeverityToColor(LogSeverity severity) {
299299
#ifdef OS_WINDOWS
300300

301301
// Returns the character attribute for the given color.
302-
WORD GetColorAttribute(GLogColor color) {
302+
static WORD GetColorAttribute(GLogColor color) {
303303
switch (color) {
304304
case COLOR_RED: return FOREGROUND_RED;
305305
case COLOR_GREEN: return FOREGROUND_GREEN;
@@ -311,7 +311,7 @@ WORD GetColorAttribute(GLogColor color) {
311311
#else
312312

313313
// Returns the ANSI color code for the given color.
314-
const char* GetAnsiColorCode(GLogColor color) {
314+
static const char* GetAnsiColorCode(GLogColor color) {
315315
switch (color) {
316316
case COLOR_RED: return "1";
317317
case COLOR_GREEN: return "2";
@@ -1710,6 +1710,7 @@ void LogToStderr() {
17101710
namespace base {
17111711
namespace internal {
17121712

1713+
bool GetExitOnDFatal();
17131714
bool GetExitOnDFatal() {
17141715
MutexLock l(&log_mutex);
17151716
return exit_on_dfatal;
@@ -1725,6 +1726,7 @@ bool GetExitOnDFatal() {
17251726
// and the stack trace is not recorded. The LOG(FATAL) *will* still
17261727
// exit the program. Since this function is used only in testing,
17271728
// these differences are acceptable.
1729+
void SetExitOnDFatal(bool value);
17281730
void SetExitOnDFatal(bool value) {
17291731
MutexLock l(&log_mutex);
17301732
exit_on_dfatal = value;

src/logging_unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,10 +1075,10 @@ TEST(Strerror, logging) {
10751075

10761076
// Simple routines to look at the sizes of generated code for LOG(FATAL) and
10771077
// CHECK(..) via objdump
1078-
void MyFatal() {
1078+
static void MyFatal() {
10791079
LOG(FATAL) << "Failed";
10801080
}
1081-
void MyCheck(bool a, bool b) {
1081+
static void MyCheck(bool a, bool b) {
10821082
CHECK_EQ(a, b);
10831083
}
10841084

src/signalhandler_unittest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using namespace GFLAGS_NAMESPACE;
5050

5151
using namespace GOOGLE_NAMESPACE;
5252

53-
void* DieInThread(void*) {
53+
static void* DieInThread(void*) {
5454
// We assume pthread_t is an integral number or a pointer, rather
5555
// than a complex struct. In some environments, pthread_self()
5656
// returns an uint64 but in some other environments pthread_self()
@@ -64,7 +64,7 @@ void* DieInThread(void*) {
6464
return NULL;
6565
}
6666

67-
void WriteToStdout(const char* data, int size) {
67+
static void WriteToStdout(const char* data, int size) {
6868
if (write(STDOUT_FILENO, data, size) < 0) {
6969
// Ignore errors.
7070
}

src/stacktrace_unittest.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ AddressRange expected_range[BACKTRACE_STEPS];
103103

104104
//-----------------------------------------------------------------------//
105105

106-
void CheckRetAddrIsInFunction(void *ret_addr, const AddressRange &range)
106+
static void CheckRetAddrIsInFunction(void *ret_addr, const AddressRange &range)
107107
{
108108
CHECK_GE(ret_addr, range.start);
109109
CHECK_LE(ret_addr, range.end);
@@ -112,7 +112,7 @@ void CheckRetAddrIsInFunction(void *ret_addr, const AddressRange &range)
112112
//-----------------------------------------------------------------------//
113113

114114
void ATTRIBUTE_NOINLINE CheckStackTrace(int);
115-
void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) {
115+
static void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) {
116116
const int STACK_LEN = 10;
117117
void *stack[STACK_LEN];
118118
int size;
@@ -148,31 +148,31 @@ void ATTRIBUTE_NOINLINE CheckStackTraceLeaf(void) {
148148
//-----------------------------------------------------------------------//
149149

150150
/* Dummy functions to make the backtrace more interesting. */
151-
void ATTRIBUTE_NOINLINE CheckStackTrace4(int i) {
151+
static void ATTRIBUTE_NOINLINE CheckStackTrace4(int i) {
152152
ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[2]);
153153
INIT_ADDRESS_RANGE(CheckStackTrace4, start, end, &expected_range[1]);
154154
DECLARE_ADDRESS_LABEL(start);
155155
for (int j = i; j >= 0; j--)
156156
CheckStackTraceLeaf();
157157
DECLARE_ADDRESS_LABEL(end);
158158
}
159-
void ATTRIBUTE_NOINLINE CheckStackTrace3(int i) {
159+
static void ATTRIBUTE_NOINLINE CheckStackTrace3(int i) {
160160
ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[3]);
161161
INIT_ADDRESS_RANGE(CheckStackTrace3, start, end, &expected_range[2]);
162162
DECLARE_ADDRESS_LABEL(start);
163163
for (int j = i; j >= 0; j--)
164164
CheckStackTrace4(j);
165165
DECLARE_ADDRESS_LABEL(end);
166166
}
167-
void ATTRIBUTE_NOINLINE CheckStackTrace2(int i) {
167+
static void ATTRIBUTE_NOINLINE CheckStackTrace2(int i) {
168168
ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[4]);
169169
INIT_ADDRESS_RANGE(CheckStackTrace2, start, end, &expected_range[3]);
170170
DECLARE_ADDRESS_LABEL(start);
171171
for (int j = i; j >= 0; j--)
172172
CheckStackTrace3(j);
173173
DECLARE_ADDRESS_LABEL(end);
174174
}
175-
void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) {
175+
static void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) {
176176
ADJUST_ADDRESS_RANGE_FROM_RA(&expected_range[5]);
177177
INIT_ADDRESS_RANGE(CheckStackTrace1, start, end, &expected_range[4]);
178178
DECLARE_ADDRESS_LABEL(start);

src/stl_logging_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct user_hash {
7171
size_t operator()(int x) const { return x; }
7272
};
7373

74-
void TestSTLLogging() {
74+
static void TestSTLLogging() {
7575
{
7676
// Test a sequence.
7777
vector<int> v;

src/symbolize.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
662662
// bytes. Output will be truncated as needed, and a NUL character is always
663663
// appended.
664664
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
665-
char *itoa_r(intptr_t i, char *buf, size_t sz, int base, size_t padding) {
665+
static char *itoa_r(intptr_t i, char *buf, size_t sz, int base, size_t padding) {
666666
// Make sure we can write at least one NUL byte.
667667
size_t n = 1;
668668
if (n > sz)
@@ -724,7 +724,7 @@ char *itoa_r(intptr_t i, char *buf, size_t sz, int base, size_t padding) {
724724

725725
// Safely appends string |source| to string |dest|. Never writes past the
726726
// buffer size |dest_size| and guarantees that |dest| is null-terminated.
727-
void SafeAppendString(const char* source, char* dest, int dest_size) {
727+
static void SafeAppendString(const char* source, char* dest, int dest_size) {
728728
int dest_string_length = strlen(dest);
729729
SAFE_ASSERT(dest_string_length < dest_size);
730730
dest += dest_string_length;
@@ -737,7 +737,7 @@ void SafeAppendString(const char* source, char* dest, int dest_size) {
737737
// Converts a 64-bit value into a hex string, and safely appends it to |dest|.
738738
// Never writes past the buffer size |dest_size| and guarantees that |dest| is
739739
// null-terminated.
740-
void SafeAppendHexNumber(uint64_t value, char* dest, int dest_size) {
740+
static void SafeAppendHexNumber(uint64_t value, char* dest, int dest_size) {
741741
// 64-bit numbers in hex can have up to 16 digits.
742742
char buf[17] = {'\0'};
743743
SafeAppendString(itoa_r(value, buf, sizeof(buf), 16, 0), dest, dest_size);

src/symbolize_unittest.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static const char *TrySymbolize(void *pc) {
8484

8585
// Make them C linkage to avoid mangled names.
8686
extern "C" {
87+
void nonstatic_func();
8788
void nonstatic_func() {
8889
volatile int a = 0;
8990
++a;
@@ -317,6 +318,7 @@ inline void* always_inline inline_func() {
317318
return pc;
318319
}
319320

321+
void* ATTRIBUTE_NOINLINE non_inline_func();
320322
void* ATTRIBUTE_NOINLINE non_inline_func() {
321323
register void *pc = NULL;
322324
#ifdef TEST_X86_32_AND_64
@@ -325,7 +327,7 @@ void* ATTRIBUTE_NOINLINE non_inline_func() {
325327
return pc;
326328
}
327329

328-
void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
330+
static void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
329331
#if defined(TEST_X86_32_AND_64) && defined(HAVE_ATTRIBUTE_NOINLINE)
330332
void *pc = non_inline_func();
331333
const char *symbol = TrySymbolize(pc);
@@ -335,7 +337,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
335337
#endif
336338
}
337339

338-
void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
340+
static void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
339341
#if defined(TEST_X86_32_AND_64) && defined(HAVE_ALWAYS_INLINE)
340342
void *pc = inline_func(); // Must be inlined.
341343
const char *symbol = TrySymbolize(pc);
@@ -347,7 +349,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
347349
}
348350

349351
// Test with a return address.
350-
void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
352+
static void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
351353
#if defined(HAVE_ATTRIBUTE_NOINLINE)
352354
void *return_address = __builtin_return_address(0);
353355
const char *symbol = TrySymbolize(return_address);

src/utilities.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void DebugWriteToStderr(const char* data, void *) {
9090
}
9191
}
9292

93-
void DebugWriteToString(const char* data, void *arg) {
93+
static void DebugWriteToString(const char* data, void *arg) {
9494
reinterpret_cast<string*>(arg)->append(data);
9595
}
9696

src/vlog_is_on.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ _START_GOOGLE_NAMESPACE_
6262

6363
namespace glog_internal_namespace_ {
6464

65+
// Used by logging_unittests.cc so can't make it static here.
66+
GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
67+
size_t patt_len,
68+
const char* str,
69+
size_t str_len);
70+
6571
// Implementation of fnmatch that does not need 0-termination
6672
// of arguments and does not allocate any memory,
6773
// but we only support "*" and "?" wildcards, not the "[...]" patterns.

0 commit comments

Comments
 (0)