Merge pull request #1347 from Burgch/fix-argc
Fix value pointed to by `_NSGetArgc()` on macOS.
This commit is contained in:
commit
1778f2091e
|
@ -138,6 +138,12 @@
|
||||||
# define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
|
#if GTEST_OS_MAC
|
||||||
|
#ifndef GTEST_OS_IOS
|
||||||
|
#include <crt_externs.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if GTEST_HAS_ABSL
|
#if GTEST_HAS_ABSL
|
||||||
#include "absl/debugging/failure_signal_handler.h"
|
#include "absl/debugging/failure_signal_handler.h"
|
||||||
#include "absl/debugging/stacktrace.h"
|
#include "absl/debugging/stacktrace.h"
|
||||||
|
@ -5825,6 +5831,17 @@ void ParseGoogleTestFlagsOnlyImpl(int* argc, CharType** argv) {
|
||||||
// other parts of Google Test.
|
// other parts of Google Test.
|
||||||
void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
|
void ParseGoogleTestFlagsOnly(int* argc, char** argv) {
|
||||||
ParseGoogleTestFlagsOnlyImpl(argc, 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) {
|
void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv) {
|
||||||
ParseGoogleTestFlagsOnlyImpl(argc, argv);
|
ParseGoogleTestFlagsOnlyImpl(argc, argv);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user