gecko-dev/testing/gtest/mozilla-changes.diff

76 строки
2.6 KiB
Diff

Mozilla changes to upstream googletest.
diff --git a/gtest/include/gtest/internal/gtest-port.h b/gtest/include/gtest/internal/gtest-port.h
--- a/gtest/include/gtest/internal/gtest-port.h
+++ b/gtest/include/gtest/internal/gtest-port.h
@@ -982,8 +982,9 @@ typedef struct _RTL_CRITICAL_SECTION GTE
// are guarded by #ifndef to give embedders a chance to define GTEST_API_ in
// gtest/internal/custom/gtest-port.h
#ifndef GTEST_API_
+/*
#ifdef _MSC_VER
# if GTEST_LINKED_AS_SHARED_LIBRARY
# define GTEST_API_ __declspec(dllimport)
# elif GTEST_CREATE_SHARED_LIBRARY
@@ -991,8 +992,9 @@ typedef struct _RTL_CRITICAL_SECTION GTE
# endif
#elif __GNUC__ >= 4 || defined(__clang__)
# define GTEST_API_ __attribute__((visibility ("default")))
#endif // _MSC_VER
+*/
#endif // GTEST_API_
#ifndef GTEST_API_
diff --git a/gtest/src/gtest-death-test.cc b/gtest/src/gtest-death-test.cc
--- a/gtest/src/gtest-death-test.cc
+++ b/gtest/src/gtest-death-test.cc
@@ -1161,9 +1161,9 @@ inline char** GetEnviron() {
}
# else
// Some POSIX platforms expect you to declare environ. extern "C" makes
// it reside in the global namespace.
-extern "C" char** environ;
+extern "C" __attribute__ ((visibility ("default"))) char** environ;
inline char** GetEnviron() { return environ; }
# endif // GTEST_OS_MAC
# if !GTEST_OS_QNX
@@ -1285,9 +1285,9 @@ static pid_t ExecDeathTestSpawnChild(cha
const bool use_fork = GTEST_FLAG(death_test_use_fork);
if (!use_fork) {
static const bool stack_grows_down = StackGrowsDown();
- const size_t stack_size = getpagesize();
+ const size_t stack_size = getpagesize() * 2;
// MMAP_ANONYMOUS is not defined on Mac, so we use MAP_ANON instead.
void* const stack = mmap(NULL, stack_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, -1, 0);
GTEST_DEATH_TEST_CHECK_(stack != MAP_FAILED);
diff --git a/gtest/src/gtest.cc b/gtest/src/gtest.cc
--- a/gtest/src/gtest.cc
+++ b/gtest/src/gtest.cc
@@ -33,8 +33,10 @@
#include "gtest/gtest.h"
#include "gtest/internal/custom/gtest.h"
#include "gtest/gtest-spi.h"
+#include "mozilla/Unused.h"
+
#include <ctype.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
@@ -4384,9 +4386,9 @@ class ScopedPrematureExitFile {
// create the file with a single "0" character in it. I/O
// errors are ignored as there's nothing better we can do and we
// don't want to fail the test because of this.
FILE* pfile = posix::FOpen(premature_exit_filepath, "w");
- fwrite("0", 1, 1, pfile);
+ mozilla::Unused << fwrite("0", 1, 1, pfile);
fclose(pfile);
}
}