diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-11-10 10:28:14 -0800 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-11-10 10:28:14 -0800 |
commit | 9c197b7ecba6019b7c81c673cf100b2fad4033ad (patch) | |
tree | aa997af1d17ed7549e654d56671cf0fa1c87e2d9 /src/google/protobuf/compiler/objectivec | |
parent | 5eb717c3006ad7da9aa6e49d40328a3963ad22a3 (diff) |
Support win32 long path for cross compiled build
Diffstat (limited to 'src/google/protobuf/compiler/objectivec')
-rw-r--r-- | src/google/protobuf/compiler/objectivec/objectivec_helpers.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc index 54dc7455..14715ef6 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc @@ -50,11 +50,6 @@ #include <google/protobuf/stubs/io_win32.h> #include <google/protobuf/stubs/strutil.h> -#if defined(_MSC_VER) -// 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::open; -#endif // NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some // error cases, so it seems to be ok to use as a back door for errors. @@ -64,6 +59,16 @@ namespace protobuf { namespace compiler { namespace objectivec { +// <io.h> is transitively included in this file. Import the functions explicitly +// in this port namespace to avoid ambiguous definition. +namespace posix { +#ifdef _WIN32 +using ::google::protobuf::internal::win32::open; +#else +using ::open; +#endif +} // namespace port + Options::Options() { // Default is the value of the env for the package prefixes. const char* file_path = getenv("GPB_OBJC_EXPECTED_PACKAGE_PREFIXES"); @@ -1469,7 +1474,7 @@ bool ParseSimpleFile( const string& path, LineConsumer* line_consumer, string* out_error) { int fd; do { - fd = open(path.c_str(), O_RDONLY); + fd = posix::open(path.c_str(), O_RDONLY); } while (fd < 0 && errno == EINTR); if (fd < 0) { *out_error = |