Merge pull request #1007 from davidben/missing-declarations
Pass the -Wmissing-declarations warning.
This commit is contained in:
commit
5b26b0fce7
@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
|
||||
return BoundSecondMatcher<Tuple2Matcher, Second>(tm, second);
|
||||
}
|
||||
|
||||
// Joins a vector of strings as if they are fields of a tuple; returns
|
||||
// the joined string. This function is exported for testing.
|
||||
GTEST_API_ string JoinAsTuple(const Strings& fields);
|
||||
|
||||
// Returns the description for a matcher defined using the MATCHER*()
|
||||
// macro where the user-supplied description string is "", if
|
||||
// 'negation' is false; otherwise returns the description of the
|
||||
|
@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
|
||||
return expectations_met;
|
||||
}
|
||||
|
||||
CallReaction intToCallReaction(int mock_behavior) {
|
||||
static CallReaction intToCallReaction(int mock_behavior) {
|
||||
if (mock_behavior >= kAllow && mock_behavior <= kFail) {
|
||||
return static_cast<internal::CallReaction>(mock_behavior);
|
||||
}
|
||||
|
@ -65,10 +65,6 @@
|
||||
|
||||
namespace testing {
|
||||
|
||||
namespace internal {
|
||||
GTEST_API_ string JoinAsTuple(const Strings& fields);
|
||||
} // namespace internal
|
||||
|
||||
namespace gmock_matchers_test {
|
||||
|
||||
using std::greater;
|
||||
|
@ -1407,21 +1407,21 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
|
||||
// type testing::TestParamInfo<class ParamType>, and return std::string.
|
||||
//
|
||||
// testing::PrintToStringParamName is a builtin test suffix generator that
|
||||
// returns the value of testing::PrintToString(GetParam()). It does not work
|
||||
// for std::string or C strings.
|
||||
// returns the value of testing::PrintToString(GetParam()).
|
||||
//
|
||||
// Note: test names must be non-empty, unique, and may only contain ASCII
|
||||
// alphanumeric characters or underscore.
|
||||
// alphanumeric characters or underscore. Because PrintToString adds quotes
|
||||
// to std::string and C strings, it won't work for these types.
|
||||
|
||||
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
|
||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
||||
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
||||
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
|
||||
(__VA_ARGS__)(info); \
|
||||
} \
|
||||
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
||||
GetTestCasePatternHolder<test_case_name>(\
|
||||
#test_case_name, \
|
||||
|
@ -480,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
|
||||
// to std::string and C strings, it won't work for these types.
|
||||
|
||||
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
|
||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||
static ::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
||||
::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||
static ::std::string gtest_##prefix##test_case_name##_EvalGenerateName_( \
|
||||
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
|
||||
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
|
||||
(__VA_ARGS__)(info); \
|
||||
} \
|
||||
int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
static int gtest_##prefix##test_case_name##_dummy_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
|
||||
GetTestCasePatternHolder<test_case_name>(\
|
||||
#test_case_name, \
|
||||
|
@ -251,7 +251,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
|
||||
// message is propagated back to the parent process. Otherwise, the
|
||||
// message is simply printed to stderr. In either case, the program
|
||||
// then exits with status 1.
|
||||
void DeathTestAbort(const std::string& message) {
|
||||
static void DeathTestAbort(const std::string& message) {
|
||||
// On a POSIX system, this function may be called from a threadsafe-style
|
||||
// death test child process, which operates on a very small stack. Use
|
||||
// the heap for any additional non-minuscule memory requirements.
|
||||
@ -977,6 +977,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
|
||||
}
|
||||
# endif // !GTEST_OS_QNX
|
||||
|
||||
# if GTEST_HAS_CLONE
|
||||
// Two utility routines that together determine the direction the stack
|
||||
// grows.
|
||||
// This could be accomplished more elegantly by a single recursive
|
||||
@ -986,20 +987,22 @@ static int ExecDeathTestChildMain(void* child_arg) {
|
||||
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
|
||||
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
|
||||
// correct answer.
|
||||
void StackLowerThanAddress(const void* ptr, bool* result) GTEST_NO_INLINE_;
|
||||
void StackLowerThanAddress(const void* ptr, bool* result) {
|
||||
static void StackLowerThanAddress(const void* ptr,
|
||||
bool* result) GTEST_NO_INLINE_;
|
||||
static void StackLowerThanAddress(const void* ptr, bool* result) {
|
||||
int dummy;
|
||||
*result = (&dummy < ptr);
|
||||
}
|
||||
|
||||
// Make sure AddressSanitizer does not tamper with the stack here.
|
||||
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
|
||||
bool StackGrowsDown() {
|
||||
static bool StackGrowsDown() {
|
||||
int dummy;
|
||||
bool result;
|
||||
StackLowerThanAddress(&dummy, &result);
|
||||
return result;
|
||||
}
|
||||
# endif // GTEST_HAS_CLONE
|
||||
|
||||
// Spawns a child process with the same executable as the current process in
|
||||
// a thread-safe manner and instructs it to run the death test. The
|
||||
@ -1215,12 +1218,12 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
|
||||
// Recreates the pipe and event handles from the provided parameters,
|
||||
// signals the event, and returns a file descriptor wrapped around the pipe
|
||||
// handle. This function is called in the child process only.
|
||||
int GetStatusFileDescriptor(unsigned int parent_process_id,
|
||||
size_t write_handle_as_size_t,
|
||||
size_t event_handle_as_size_t) {
|
||||
static int GetStatusFileDescriptor(unsigned int parent_process_id,
|
||||
size_t write_handle_as_size_t,
|
||||
size_t event_handle_as_size_t) {
|
||||
AutoHandle parent_process_handle(::OpenProcess(PROCESS_DUP_HANDLE,
|
||||
FALSE, // Non-inheritable.
|
||||
parent_process_id));
|
||||
FALSE, // Non-inheritable.
|
||||
parent_process_id));
|
||||
if (parent_process_handle.Get() == INVALID_HANDLE_VALUE) {
|
||||
DeathTestAbort("Unable to open parent process " +
|
||||
StreamableToString(parent_process_id));
|
||||
|
@ -663,7 +663,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
|
||||
}
|
||||
|
||||
// Helper function used by ValidateRegex() to format error messages.
|
||||
std::string FormatRegexSyntaxError(const char* regex, int index) {
|
||||
static std::string FormatRegexSyntaxError(const char* regex, int index) {
|
||||
return (Message() << "Syntax error at index " << index
|
||||
<< " in simple regular expression \"" << regex << "\": ").GetString();
|
||||
}
|
||||
@ -1007,7 +1007,9 @@ static CapturedStream* g_captured_stderr = NULL;
|
||||
static CapturedStream* g_captured_stdout = NULL;
|
||||
|
||||
// Starts capturing an output stream (stdout/stderr).
|
||||
void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||
static void CaptureStream(int fd,
|
||||
const char* stream_name,
|
||||
CapturedStream** stream) {
|
||||
if (*stream != NULL) {
|
||||
GTEST_LOG_(FATAL) << "Only one " << stream_name
|
||||
<< " capturer can exist at a time.";
|
||||
@ -1016,7 +1018,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
|
||||
}
|
||||
|
||||
// Stops capturing the output stream and returns the captured string.
|
||||
std::string GetCapturedStream(CapturedStream** captured_stream) {
|
||||
static std::string GetCapturedStream(CapturedStream** captured_stream) {
|
||||
const std::string content = (*captured_stream)->GetCapturedString();
|
||||
|
||||
delete *captured_stream;
|
||||
|
@ -622,12 +622,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
|
||||
// This predicate-formatter checks that 'results' contains a test part
|
||||
// failure of the given type and that the failure message contains the
|
||||
// given substring.
|
||||
AssertionResult HasOneFailure(const char* /* results_expr */,
|
||||
const char* /* type_expr */,
|
||||
const char* /* substr_expr */,
|
||||
const TestPartResultArray& results,
|
||||
TestPartResult::Type type,
|
||||
const std::string& substr) {
|
||||
static AssertionResult HasOneFailure(const char* /* results_expr */,
|
||||
const char* /* type_expr */,
|
||||
const char* /* substr_expr */,
|
||||
const TestPartResultArray& results,
|
||||
TestPartResult::Type type,
|
||||
const std::string& substr) {
|
||||
const std::string expected(type == TestPartResult::kFatalFailure ?
|
||||
"1 fatal failure" :
|
||||
"1 non-fatal failure");
|
||||
@ -2130,8 +2130,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) {
|
||||
return word_list.GetString();
|
||||
}
|
||||
|
||||
bool ValidateTestPropertyName(const std::string& property_name,
|
||||
const std::vector<std::string>& reserved_names) {
|
||||
static bool ValidateTestPropertyName(
|
||||
const std::string& property_name,
|
||||
const std::vector<std::string>& reserved_names) {
|
||||
if (std::find(reserved_names.begin(), reserved_names.end(), property_name) !=
|
||||
reserved_names.end()) {
|
||||
ADD_FAILURE() << "Reserved key used in RecordProperty(): " << property_name
|
||||
@ -2876,7 +2877,7 @@ enum GTestColor {
|
||||
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
|
||||
|
||||
// Returns the character attribute for the given color.
|
||||
WORD GetColorAttribute(GTestColor color) {
|
||||
static WORD GetColorAttribute(GTestColor color) {
|
||||
switch (color) {
|
||||
case COLOR_RED: return FOREGROUND_RED;
|
||||
case COLOR_GREEN: return FOREGROUND_GREEN;
|
||||
@ -2885,7 +2886,7 @@ WORD GetColorAttribute(GTestColor color) {
|
||||
}
|
||||
}
|
||||
|
||||
int GetBitOffset(WORD color_mask) {
|
||||
static int GetBitOffset(WORD color_mask) {
|
||||
if (color_mask == 0) return 0;
|
||||
|
||||
int bitOffset = 0;
|
||||
@ -2896,7 +2897,7 @@ int GetBitOffset(WORD color_mask) {
|
||||
return bitOffset;
|
||||
}
|
||||
|
||||
WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
||||
static WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
||||
// Let's reuse the BG
|
||||
static const WORD background_mask = BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY;
|
||||
static const WORD foreground_mask = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||
@ -2916,7 +2917,7 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
|
||||
|
||||
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
|
||||
// an invalid input.
|
||||
const char* GetAnsiColorCode(GTestColor color) {
|
||||
static const char* GetAnsiColorCode(GTestColor color) {
|
||||
switch (color) {
|
||||
case COLOR_RED: return "1";
|
||||
case COLOR_GREEN: return "2";
|
||||
@ -2969,7 +2970,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
|
||||
// This routine must actually emit the characters rather than return a string
|
||||
// that would be colored when printed, as can be done on Linux.
|
||||
GTEST_ATTRIBUTE_PRINTF_(2, 3)
|
||||
void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
@ -3023,7 +3024,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
||||
static const char kTypeParamLabel[] = "TypeParam";
|
||||
static const char kValueParamLabel[] = "GetParam()";
|
||||
|
||||
void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
||||
static void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
|
||||
const char* const type_param = test_info.type_param();
|
||||
const char* const value_param = test_info.value_param();
|
||||
|
||||
@ -5021,9 +5022,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
|
||||
// part can be omitted.
|
||||
//
|
||||
// Returns the value of the flag, or NULL if the parsing failed.
|
||||
const char* ParseFlagValue(const char* str,
|
||||
const char* flag,
|
||||
bool def_optional) {
|
||||
static const char* ParseFlagValue(const char* str,
|
||||
const char* flag,
|
||||
bool def_optional) {
|
||||
// str and flag must not be NULL.
|
||||
if (str == NULL || flag == NULL) return NULL;
|
||||
|
||||
@ -5059,7 +5060,7 @@ const char* ParseFlagValue(const char* str,
|
||||
//
|
||||
// On success, stores the value of the flag in *value, and returns
|
||||
// true. On failure, returns false without changing *value.
|
||||
bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
||||
static bool ParseBoolFlag(const char* str, const char* flag, bool* value) {
|
||||
// Gets the value of the flag as a string.
|
||||
const char* const value_str = ParseFlagValue(str, flag, true);
|
||||
|
||||
@ -5093,7 +5094,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
|
||||
//
|
||||
// On success, stores the value of the flag in *value, and returns
|
||||
// true. On failure, returns false without changing *value.
|
||||
bool ParseStringFlag(const char* str, const char* flag, std::string* value) {
|
||||
static bool ParseStringFlag(const char* str,
|
||||
const char* flag,
|
||||
std::string* value) {
|
||||
// Gets the value of the flag as a string.
|
||||
const char* const value_str = ParseFlagValue(str, flag, false);
|
||||
|
||||
@ -5229,7 +5232,7 @@ static const char kColorEncodedHelpMessage[] =
|
||||
"(not one in your own code or tests), please report it to\n"
|
||||
"@G<" GTEST_DEV_EMAIL_ ">@D.\n";
|
||||
|
||||
bool ParseGoogleTestFlag(const char* const arg) {
|
||||
static bool ParseGoogleTestFlag(const char* const arg) {
|
||||
return ParseBoolFlag(arg, kAlsoRunDisabledTestsFlag,
|
||||
>EST_FLAG(also_run_disabled_tests)) ||
|
||||
ParseBoolFlag(arg, kBreakOnFailureFlag,
|
||||
@ -5259,7 +5262,7 @@ bool ParseGoogleTestFlag(const char* const arg) {
|
||||
}
|
||||
|
||||
#if GTEST_USE_OWN_FLAGFILE_FLAG_
|
||||
void LoadFlagsFromFile(const std::string& path) {
|
||||
static void LoadFlagsFromFile(const std::string& path) {
|
||||
FILE* flagfile = posix::FOpen(path.c_str(), "r");
|
||||
if (!flagfile) {
|
||||
GTEST_LOG_(FATAL) << "Unable to open file \""
|
||||
|
Loading…
Reference in New Issue
Block a user