diff options
Diffstat (limited to 'src/google/protobuf/compiler/command_line_interface_unittest.cc')
-rw-r--r-- | src/google/protobuf/compiler/command_line_interface_unittest.cc | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index c4db7f99..2b0b641e 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -35,10 +35,7 @@ #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> - -#ifdef _MSC_VER -#include <io.h> -#else +#ifndef _MSC_VER #include <unistd.h> #endif #include <memory> @@ -57,7 +54,6 @@ #include <google/protobuf/unittest.pb.h> #include <google/protobuf/io/printer.h> #include <google/protobuf/io/zero_copy_stream.h> - #include <google/protobuf/descriptor.pb.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/stubs/substitute.h> @@ -72,22 +68,20 @@ namespace google { namespace protobuf { namespace compiler { -// Disable the whole test when we use tcmalloc for "draconian" heap checks, in -// which case tcmalloc will print warnings that fail the plugin tests. -#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN - #if defined(_WIN32) -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif -#ifndef F_OK -#define F_OK 00 // not defined by MSVC for whatever reason -#endif +// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import +// them like we do below. +using google::protobuf::internal::win32::access; +using google::protobuf::internal::win32::dup; +using google::protobuf::internal::win32::dup2; +using google::protobuf::internal::win32::close; +using google::protobuf::internal::win32::open; +using google::protobuf::internal::win32::write; #endif +// Disable the whole test when we use tcmalloc for "draconian" heap checks, in +// which case tcmalloc will print warnings that fail the plugin tests. +#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN namespace { |