mirror of
https://github.com/google/googletest.git
synced 2025-01-21 15:11:57 +08:00
Fix value pointed to by _NSGetArgc()
on macOS
This commit is contained in:
parent
a868e618c0
commit
ad383b274d
@ -146,6 +146,12 @@
|
||||
# define vsnprintf _vsnprintf
|
||||
#endif // GTEST_OS_WINDOWS
|
||||
|
||||
#if GTEST_OS_MAC
|
||||
# ifndef GTEST_OS_IOS
|
||||
# include <crt_externs.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace testing {
|
||||
|
||||
using internal::CountIf;
|
||||
@ -5341,6 +5347,16 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
|
||||
}
|
||||
}
|
||||
|
||||
// Fix the value of *_NSGetArgc() on macOS, but iff
|
||||
// *_NSGetArgv() == argv
|
||||
#if GTEST_OS_MAC
|
||||
# ifndef GTEST_OS_IOS
|
||||
if (*_NSGetArgv() == argv) {
|
||||
*_NSGetArgc() = *argc;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (g_help_flag) {
|
||||
// We print the help here instead of in RUN_ALL_TESTS(), as the
|
||||
// latter may not be called at all if the user is using Google
|
||||
|
Loading…
x
Reference in New Issue
Block a user