summaryrefslogtreecommitdiffstats
path: root/googletest/src
diff options
context:
space:
mode:
authorGaspard Petit <gpetit@eidosmontreal.com>2022-06-11 14:26:41 (GMT)
committerGaspard Petit <gpetit@eidosmontreal.com>2022-06-11 14:26:41 (GMT)
commitfe735a698657a7fffe6b5062c6bf5b13b6a6950c (patch)
treec64bd383eff5edf82024749209032f4d51dc701c /googletest/src
parent900c3f9cd534f22692df7d7f78e0e1cb0c226085 (diff)
downloadgoogletest-fe735a698657a7fffe6b5062c6bf5b13b6a6950c.zip
googletest-fe735a698657a7fffe6b5062c6bf5b13b6a6950c.tar.gz
googletest-fe735a698657a7fffe6b5062c6bf5b13b6a6950c.tar.bz2
Move declaration of kStdOutFileNo and kStdErrFilenorefs/pull/3863/head
Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice
Diffstat (limited to 'googletest/src')
-rw-r--r--googletest/src/gtest-port.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc
index 7cf6d41..cf66d9e 100644
--- a/googletest/src/gtest-port.cc
+++ b/googletest/src/gtest-port.cc
@@ -90,17 +90,6 @@
namespace testing {
namespace internal {
-#if GTEST_HAS_STREAM_REDIRECTION
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
-const int kStdOutFileno = 1;
-const int kStdErrFileno = 2;
-#else
-const int kStdOutFileno = STDOUT_FILENO;
-const int kStdErrFileno = STDERR_FILENO;
-#endif // _MSC_VER
-#endif // GTEST_HAS_STREAM_REDIRECTION
-
#if GTEST_OS_LINUX || GTEST_OS_GNU_HURD
namespace {
@@ -1179,6 +1168,15 @@ static std::string GetCapturedStream(CapturedStream** captured_stream) {
return content;
}
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+// MSVC and C++Builder do not provide a definition of STDERR_FILENO.
+const int kStdOutFileno = 1;
+const int kStdErrFileno = 2;
+#else
+const int kStdOutFileno = STDOUT_FILENO;
+const int kStdErrFileno = STDERR_FILENO;
+#endif // _MSC_VER
+
// Starts capturing stdout.
void CaptureStdout() {
CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);