aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-21 21:19:05 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-21 21:19:05 +0000
commitd1ce7a2839dbc3b882d9fb8fc01f69ebbfbd0cfd (patch)
tree50dcb3b63de44333fa3f191cbd996e76b2922538 /src/google/protobuf/compiler
parentf2a732938eddd212804db8c87f608cc11325b042 (diff)
Fix build on MSVC.
Diffstat (limited to 'src/google/protobuf/compiler')
-rw-r--r--src/google/protobuf/compiler/plugin.cc9
-rw-r--r--src/google/protobuf/compiler/test_plugin.cc7
2 files changed, 15 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc
index 4757652f..a4aedafb 100644
--- a/src/google/protobuf/compiler/plugin.cc
+++ b/src/google/protobuf/compiler/plugin.cc
@@ -34,11 +34,18 @@
#include <iostream>
#include <set>
-#include <unistd.h>
#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
+#ifndef STDIN_FILENO
+#define STDIN_FILENO 0
+#endif
+#ifndef STDOUT_FILENO
+#define STDOUT_FILENO 1
+#endif
+#else
+#include <unistd.h>
#endif
#include <google/protobuf/stubs/common.h>
diff --git a/src/google/protobuf/compiler/test_plugin.cc b/src/google/protobuf/compiler/test_plugin.cc
index 75fdca0d..5cbbf3d9 100644
--- a/src/google/protobuf/compiler/test_plugin.cc
+++ b/src/google/protobuf/compiler/test_plugin.cc
@@ -34,11 +34,18 @@
// command_line_interface_unittest.
#include <string>
+#include <stdlib.h>
#include <google/protobuf/compiler/plugin.h>
#include <google/protobuf/compiler/mock_code_generator.h>
#include <google/protobuf/stubs/strutil.h>
int main(int argc, char* argv[]) {
+#ifdef _MSC_VER
+ // Don't print a silly message or stick a modal dialog box in my face,
+ // please.
+ _set_abort_behavior(0, ~0);
+#endif // !_MSC_VER
+
google::protobuf::compiler::MockCodeGenerator generator("test_plugin");
return google::protobuf::compiler::PluginMain(argc, argv, &generator);
}