diff options
Diffstat (limited to 'googletest/src')
-rw-r--r-- | googletest/src/gtest.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 0aeeb8e..f6dddb0 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -139,6 +139,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; @@ -5340,6 +5346,17 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) { // other parts of Google Test. void ParseGoogleTestFlagsOnly(int* argc, char** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); + + // Fix the value of *_NSGetArgc() on macOS, but iff + // *_NSGetArgv() == argv + // Only applicable to char** version of argv +#if GTEST_OS_MAC +# ifndef GTEST_OS_IOS + if (*_NSGetArgv() == argv) { + *_NSGetArgc() = *argc; + } +# endif +#endif } void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) { ParseGoogleTestFlagsOnlyImpl(argc, argv); |