]> git-server-git.apps.pok.os.sepia.ceph.com Git - googletest.git/commitdiff
Move declaration of kStdOutFileNo and kStdErrFileno
authorGaspard Petit <gpetit@eidosmontreal.com>
Sat, 11 Jun 2022 14:26:41 +0000 (10:26 -0400)
committerGaspard Petit <gpetit@eidosmontreal.com>
Sat, 11 Jun 2022 14:26:41 +0000 (10:26 -0400)
Move declaration of kStdOutFileNo and kStdErrFileno closer to where they are used to avoid having to guard for GTEST_HAS_STREAM_REDIRECTION twice

googletest/src/gtest-port.cc

index 7cf6d4139b0bb18c373f08fb5c8e2ec77cd68be0..cf66d9e80d79a5c75bc467a27ed10dee6cf7f4f6 100644 (file)
 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);