Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
5b26b0fc
Unverified
Commit
5b26b0fc
authored
Jan 05, 2018
by
Gennadiy Civil
Committed by
GitHub
Jan 05, 2018
Browse files
Merge pull request #1007 from davidben/missing-declarations
Pass the -Wmissing-declarations warning.
parents
abbc0f81
6b4967a2
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
47 deletions
+55
-47
googlemock/include/gmock/gmock-matchers.h
googlemock/include/gmock/gmock-matchers.h
+4
-0
googlemock/src/gmock-spec-builders.cc
googlemock/src/gmock-spec-builders.cc
+1
-1
googlemock/test/gmock-matchers_test.cc
googlemock/test/gmock-matchers_test.cc
+0
-4
googletest/include/gtest/gtest-param-test.h
googletest/include/gtest/gtest-param-test.h
+6
-6
googletest/include/gtest/gtest-param-test.h.pump
googletest/include/gtest/gtest-param-test.h.pump
+3
-3
googletest/src/gtest-death-test.cc
googletest/src/gtest-death-test.cc
+12
-9
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+5
-3
googletest/src/gtest.cc
googletest/src/gtest.cc
+24
-21
No files found.
googlemock/include/gmock/gmock-matchers.h
View file @
5b26b0fc
...
@@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
...
@@ -3615,6 +3615,10 @@ BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
return
BoundSecondMatcher
<
Tuple2Matcher
,
Second
>
(
tm
,
second
);
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*()
// Returns the description for a matcher defined using the MATCHER*()
// macro where the user-supplied description string is "", if
// macro where the user-supplied description string is "", if
// 'negation' is false; otherwise returns the description of the
// 'negation' is false; otherwise returns the description of the
...
...
googlemock/src/gmock-spec-builders.cc
View file @
5b26b0fc
...
@@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
...
@@ -508,7 +508,7 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
return
expectations_met
;
return
expectations_met
;
}
}
CallReaction
intToCallReaction
(
int
mock_behavior
)
{
static
CallReaction
intToCallReaction
(
int
mock_behavior
)
{
if
(
mock_behavior
>=
kAllow
&&
mock_behavior
<=
kFail
)
{
if
(
mock_behavior
>=
kAllow
&&
mock_behavior
<=
kFail
)
{
return
static_cast
<
internal
::
CallReaction
>
(
mock_behavior
);
return
static_cast
<
internal
::
CallReaction
>
(
mock_behavior
);
}
}
...
...
googlemock/test/gmock-matchers_test.cc
View file @
5b26b0fc
...
@@ -65,10 +65,6 @@
...
@@ -65,10 +65,6 @@
namespace
testing
{
namespace
testing
{
namespace
internal
{
GTEST_API_
string
JoinAsTuple
(
const
Strings
&
fields
);
}
// namespace internal
namespace
gmock_matchers_test
{
namespace
gmock_matchers_test
{
using
std
::
greater
;
using
std
::
greater
;
...
...
googletest/include/gtest/gtest-param-test.h
View file @
5b26b0fc
...
@@ -1407,21 +1407,21 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
...
@@ -1407,21 +1407,21 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
// type testing::TestParamInfo<class ParamType>, and return std::string.
// type testing::TestParamInfo<class ParamType>, and return std::string.
//
//
// testing::PrintToStringParamName is a builtin test suffix generator that
// testing::PrintToStringParamName is a builtin test suffix generator that
// returns the value of testing::PrintToString(GetParam()). It does not work
// returns the value of testing::PrintToString(GetParam()).
// for std::string or C strings.
//
//
// Note: test names must be non-empty, unique, and may only contain ASCII
// 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, ...) \
# 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; } \
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) { \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \
(__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(). \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \
#test_case_name, \
...
...
googletest/include/gtest/gtest-param-test.h.pump
View file @
5b26b0fc
...
@@ -480,14 +480,14 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
...
@@ -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.
// to std::string and C strings, it won't work for these types.
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator, ...) \
# 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; } \
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) { \
const ::testing::TestParamInfo<test_case_name::ParamType>& info) { \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
return ::testing::internal::GetParamNameGen<test_case_name::ParamType> \
(__VA_ARGS__)(info); \
(__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(). \
::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
GetTestCasePatternHolder<test_case_name>(\
GetTestCasePatternHolder<test_case_name>(\
#test_case_name, \
#test_case_name, \
...
...
googletest/src/gtest-death-test.cc
View file @
5b26b0fc
...
@@ -251,7 +251,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
...
@@ -251,7 +251,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
// message is propagated back to the parent process. Otherwise, the
// message is propagated back to the parent process. Otherwise, the
// message is simply printed to stderr. In either case, the program
// message is simply printed to stderr. In either case, the program
// then exits with status 1.
// 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
// 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
// death test child process, which operates on a very small stack. Use
// the heap for any additional non-minuscule memory requirements.
// the heap for any additional non-minuscule memory requirements.
...
@@ -977,6 +977,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
...
@@ -977,6 +977,7 @@ static int ExecDeathTestChildMain(void* child_arg) {
}
}
# endif // !GTEST_OS_QNX
# endif // !GTEST_OS_QNX
# if GTEST_HAS_CLONE
// Two utility routines that together determine the direction the stack
// Two utility routines that together determine the direction the stack
// grows.
// grows.
// This could be accomplished more elegantly by a single recursive
// This could be accomplished more elegantly by a single recursive
...
@@ -986,20 +987,22 @@ static int ExecDeathTestChildMain(void* child_arg) {
...
@@ -986,20 +987,22 @@ static int ExecDeathTestChildMain(void* child_arg) {
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
// GTEST_NO_INLINE_ is required to prevent GCC 4.6 from inlining
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
// StackLowerThanAddress into StackGrowsDown, which then doesn't give
// correct answer.
// correct answer.
void
StackLowerThanAddress
(
const
void
*
ptr
,
bool
*
result
)
GTEST_NO_INLINE_
;
static
void
StackLowerThanAddress
(
const
void
*
ptr
,
void
StackLowerThanAddress
(
const
void
*
ptr
,
bool
*
result
)
{
bool
*
result
)
GTEST_NO_INLINE_
;
static
void
StackLowerThanAddress
(
const
void
*
ptr
,
bool
*
result
)
{
int
dummy
;
int
dummy
;
*
result
=
(
&
dummy
<
ptr
);
*
result
=
(
&
dummy
<
ptr
);
}
}
// Make sure AddressSanitizer does not tamper with the stack here.
// Make sure AddressSanitizer does not tamper with the stack here.
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
bool
StackGrowsDown
()
{
static
bool
StackGrowsDown
()
{
int
dummy
;
int
dummy
;
bool
result
;
bool
result
;
StackLowerThanAddress
(
&
dummy
,
&
result
);
StackLowerThanAddress
(
&
dummy
,
&
result
);
return
result
;
return
result
;
}
}
# endif // GTEST_HAS_CLONE
// Spawns a child process with the same executable as the current process in
// 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
// 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,
...
@@ -1215,12 +1218,12 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
// Recreates the pipe and event handles from the provided parameters,
// Recreates the pipe and event handles from the provided parameters,
// signals the event, and returns a file descriptor wrapped around the pipe
// signals the event, and returns a file descriptor wrapped around the pipe
// handle. This function is called in the child process only.
// handle. This function is called in the child process only.
int
GetStatusFileDescriptor
(
unsigned
int
parent_process_id
,
static
int
GetStatusFileDescriptor
(
unsigned
int
parent_process_id
,
size_t
write_handle_as_size_t
,
size_t
write_handle_as_size_t
,
size_t
event_handle_as_size_t
)
{
size_t
event_handle_as_size_t
)
{
AutoHandle
parent_process_handle
(
::
OpenProcess
(
PROCESS_DUP_HANDLE
,
AutoHandle
parent_process_handle
(
::
OpenProcess
(
PROCESS_DUP_HANDLE
,
FALSE
,
// Non-inheritable.
FALSE
,
// Non-inheritable.
parent_process_id
));
parent_process_id
));
if
(
parent_process_handle
.
Get
()
==
INVALID_HANDLE_VALUE
)
{
if
(
parent_process_handle
.
Get
()
==
INVALID_HANDLE_VALUE
)
{
DeathTestAbort
(
"Unable to open parent process "
+
DeathTestAbort
(
"Unable to open parent process "
+
StreamableToString
(
parent_process_id
));
StreamableToString
(
parent_process_id
));
...
...
googletest/src/gtest-port.cc
View file @
5b26b0fc
...
@@ -663,7 +663,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
...
@@ -663,7 +663,7 @@ bool AtomMatchesChar(bool escaped, char pattern_char, char ch) {
}
}
// Helper function used by ValidateRegex() to format error messages.
// 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
return
(
Message
()
<<
"Syntax error at index "
<<
index
<<
" in simple regular expression
\"
"
<<
regex
<<
"
\"
: "
).
GetString
();
<<
" in simple regular expression
\"
"
<<
regex
<<
"
\"
: "
).
GetString
();
}
}
...
@@ -1007,7 +1007,9 @@ static CapturedStream* g_captured_stderr = NULL;
...
@@ -1007,7 +1007,9 @@ static CapturedStream* g_captured_stderr = NULL;
static
CapturedStream
*
g_captured_stdout
=
NULL
;
static
CapturedStream
*
g_captured_stdout
=
NULL
;
// Starts capturing an output stream (stdout/stderr).
// 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
)
{
if
(
*
stream
!=
NULL
)
{
GTEST_LOG_
(
FATAL
)
<<
"Only one "
<<
stream_name
GTEST_LOG_
(
FATAL
)
<<
"Only one "
<<
stream_name
<<
" capturer can exist at a time."
;
<<
" capturer can exist at a time."
;
...
@@ -1016,7 +1018,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
...
@@ -1016,7 +1018,7 @@ void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
}
}
// Stops capturing the output stream and returns the captured string.
// 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
();
const
std
::
string
content
=
(
*
captured_stream
)
->
GetCapturedString
();
delete
*
captured_stream
;
delete
*
captured_stream
;
...
...
googletest/src/gtest.cc
View file @
5b26b0fc
...
@@ -622,12 +622,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
...
@@ -622,12 +622,12 @@ extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
// This predicate-formatter checks that 'results' contains a test part
// This predicate-formatter checks that 'results' contains a test part
// failure of the given type and that the failure message contains the
// failure of the given type and that the failure message contains the
// given substring.
// given substring.
AssertionResult
HasOneFailure
(
const
char
*
/* results_expr */
,
static
AssertionResult
HasOneFailure
(
const
char
*
/* results_expr */
,
const
char
*
/* type_expr */
,
const
char
*
/* type_expr */
,
const
char
*
/* substr_expr */
,
const
char
*
/* substr_expr */
,
const
TestPartResultArray
&
results
,
const
TestPartResultArray
&
results
,
TestPartResult
::
Type
type
,
TestPartResult
::
Type
type
,
const
std
::
string
&
substr
)
{
const
std
::
string
&
substr
)
{
const
std
::
string
expected
(
type
==
TestPartResult
::
kFatalFailure
?
const
std
::
string
expected
(
type
==
TestPartResult
::
kFatalFailure
?
"1 fatal failure"
:
"1 fatal failure"
:
"1 non-fatal failure"
);
"1 non-fatal failure"
);
...
@@ -2130,8 +2130,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) {
...
@@ -2130,8 +2130,9 @@ static std::string FormatWordList(const std::vector<std::string>& words) {
return
word_list
.
GetString
();
return
word_list
.
GetString
();
}
}
bool
ValidateTestPropertyName
(
const
std
::
string
&
property_name
,
static
bool
ValidateTestPropertyName
(
const
std
::
vector
<
std
::
string
>&
reserved_names
)
{
const
std
::
string
&
property_name
,
const
std
::
vector
<
std
::
string
>&
reserved_names
)
{
if
(
std
::
find
(
reserved_names
.
begin
(),
reserved_names
.
end
(),
property_name
)
!=
if
(
std
::
find
(
reserved_names
.
begin
(),
reserved_names
.
end
(),
property_name
)
!=
reserved_names
.
end
())
{
reserved_names
.
end
())
{
ADD_FAILURE
()
<<
"Reserved key used in RecordProperty(): "
<<
property_name
ADD_FAILURE
()
<<
"Reserved key used in RecordProperty(): "
<<
property_name
...
@@ -2876,7 +2877,7 @@ enum GTestColor {
...
@@ -2876,7 +2877,7 @@ enum GTestColor {
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
!GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT && !GTEST_OS_WINDOWS_MINGW
// Returns the character attribute for the given color.
// Returns the character attribute for the given color.
WORD
GetColorAttribute
(
GTestColor
color
)
{
static
WORD
GetColorAttribute
(
GTestColor
color
)
{
switch
(
color
)
{
switch
(
color
)
{
case
COLOR_RED
:
return
FOREGROUND_RED
;
case
COLOR_RED
:
return
FOREGROUND_RED
;
case
COLOR_GREEN
:
return
FOREGROUND_GREEN
;
case
COLOR_GREEN
:
return
FOREGROUND_GREEN
;
...
@@ -2885,7 +2886,7 @@ WORD GetColorAttribute(GTestColor color) {
...
@@ -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
;
if
(
color_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
int
bitOffset
=
0
;
...
@@ -2896,7 +2897,7 @@ int GetBitOffset(WORD color_mask) {
...
@@ -2896,7 +2897,7 @@ int GetBitOffset(WORD color_mask) {
return
bitOffset
;
return
bitOffset
;
}
}
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
static
WORD
GetNewColor
(
GTestColor
color
,
WORD
old_color_attrs
)
{
// Let's reuse the BG
// Let's reuse the BG
static
const
WORD
background_mask
=
BACKGROUND_BLUE
|
BACKGROUND_GREEN
|
BACKGROUND_RED
|
BACKGROUND_INTENSITY
;
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
;
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) {
...
@@ -2916,7 +2917,7 @@ WORD GetNewColor(GTestColor color, WORD old_color_attrs) {
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
// Returns the ANSI color code for the given color. COLOR_DEFAULT is
// an invalid input.
// an invalid input.
const
char
*
GetAnsiColorCode
(
GTestColor
color
)
{
static
const
char
*
GetAnsiColorCode
(
GTestColor
color
)
{
switch
(
color
)
{
switch
(
color
)
{
case
COLOR_RED
:
return
"1"
;
case
COLOR_RED
:
return
"1"
;
case
COLOR_GREEN
:
return
"2"
;
case
COLOR_GREEN
:
return
"2"
;
...
@@ -2969,7 +2970,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
...
@@ -2969,7 +2970,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
// This routine must actually emit the characters rather than return a string
// This routine must actually emit the characters rather than return a string
// that would be colored when printed, as can be done on Linux.
// that would be colored when printed, as can be done on Linux.
GTEST_ATTRIBUTE_PRINTF_
(
2
,
3
)
GTEST_ATTRIBUTE_PRINTF_
(
2
,
3
)
void
ColoredPrintf
(
GTestColor
color
,
const
char
*
fmt
,
...)
{
static
void
ColoredPrintf
(
GTestColor
color
,
const
char
*
fmt
,
...)
{
va_list
args
;
va_list
args
;
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
...
@@ -3023,7 +3024,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
...
@@ -3023,7 +3024,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
static
const
char
kTypeParamLabel
[]
=
"TypeParam"
;
static
const
char
kTypeParamLabel
[]
=
"TypeParam"
;
static
const
char
kValueParamLabel
[]
=
"GetParam()"
;
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
type_param
=
test_info
.
type_param
();
const
char
*
const
value_param
=
test_info
.
value_param
();
const
char
*
const
value_param
=
test_info
.
value_param
();
...
@@ -5021,9 +5022,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
...
@@ -5021,9 +5022,9 @@ bool SkipPrefix(const char* prefix, const char** pstr) {
// part can be omitted.
// part can be omitted.
//
//
// Returns the value of the flag, or NULL if the parsing failed.
// Returns the value of the flag, or NULL if the parsing failed.
const
char
*
ParseFlagValue
(
const
char
*
str
,
static
const
char
*
ParseFlagValue
(
const
char
*
str
,
const
char
*
flag
,
const
char
*
flag
,
bool
def_optional
)
{
bool
def_optional
)
{
// str and flag must not be NULL.
// str and flag must not be NULL.
if
(
str
==
NULL
||
flag
==
NULL
)
return
NULL
;
if
(
str
==
NULL
||
flag
==
NULL
)
return
NULL
;
...
@@ -5059,7 +5060,7 @@ const char* ParseFlagValue(const char* str,
...
@@ -5059,7 +5060,7 @@ const char* ParseFlagValue(const char* str,
//
//
// On success, stores the value of the flag in *value, and returns
// On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value.
// 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.
// Gets the value of the flag as a string.
const
char
*
const
value_str
=
ParseFlagValue
(
str
,
flag
,
true
);
const
char
*
const
value_str
=
ParseFlagValue
(
str
,
flag
,
true
);
...
@@ -5093,7 +5094,9 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
...
@@ -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
// On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value.
// 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.
// Gets the value of the flag as a string.
const
char
*
const
value_str
=
ParseFlagValue
(
str
,
flag
,
false
);
const
char
*
const
value_str
=
ParseFlagValue
(
str
,
flag
,
false
);
...
@@ -5229,7 +5232,7 @@ static const char kColorEncodedHelpMessage[] =
...
@@ -5229,7 +5232,7 @@ static const char kColorEncodedHelpMessage[] =
"(not one in your own code or tests), please report it to
\n
"
"(not one in your own code or tests), please report it to
\n
"
"@G<"
GTEST_DEV_EMAIL_
">@D.
\n
"
;
"@G<"
GTEST_DEV_EMAIL_
">@D.
\n
"
;
bool
ParseGoogleTestFlag
(
const
char
*
const
arg
)
{
static
bool
ParseGoogleTestFlag
(
const
char
*
const
arg
)
{
return
ParseBoolFlag
(
arg
,
kAlsoRunDisabledTestsFlag
,
return
ParseBoolFlag
(
arg
,
kAlsoRunDisabledTestsFlag
,
&
GTEST_FLAG
(
also_run_disabled_tests
))
||
&
GTEST_FLAG
(
also_run_disabled_tests
))
||
ParseBoolFlag
(
arg
,
kBreakOnFailureFlag
,
ParseBoolFlag
(
arg
,
kBreakOnFailureFlag
,
...
@@ -5259,7 +5262,7 @@ bool ParseGoogleTestFlag(const char* const arg) {
...
@@ -5259,7 +5262,7 @@ bool ParseGoogleTestFlag(const char* const arg) {
}
}
#if GTEST_USE_OWN_FLAGFILE_FLAG_
#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"
);
FILE
*
flagfile
=
posix
::
FOpen
(
path
.
c_str
(),
"r"
);
if
(
!
flagfile
)
{
if
(
!
flagfile
)
{
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment