summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2014-09-18 23:08:25 (GMT)
committerNico Weber <thakis@chromium.org>2014-09-18 23:09:20 (GMT)
commitac047b1f7efe3e90c2759864b57fd7c0d9404313 (patch)
tree22393d34d3ae63cf375841e127a02b8d89cdf65d
parentff2739b118ca8a3c2e0f2709a2852acced0d8407 (diff)
downloadNinja-ac047b1f7efe3e90c2759864b57fd7c0d9404313.zip
Ninja-ac047b1f7efe3e90c2759864b57fd7c0d9404313.tar.gz
Ninja-ac047b1f7efe3e90c2759864b57fd7c0d9404313.tar.bz2
Fix building tests on Windows again.
Turns out gtest was pulling in sys/stat.h, and we were using stat() through that in tests. This doesn't work with old MSVCs, so we should probably replace that with RealDiskInterface in a follow-up.
-rw-r--r--src/build_log_test.cc2
-rw-r--r--src/deps_log_test.cc2
-rw-r--r--src/getopt.c4
-rw-r--r--src/getopt.h6
-rw-r--r--src/includes_normalize_test.cc2
-rw-r--r--src/test.cc13
6 files changed, 17 insertions, 12 deletions
diff --git a/src/build_log_test.cc b/src/build_log_test.cc
index 6738c7b..2c41ba6 100644
--- a/src/build_log_test.cc
+++ b/src/build_log_test.cc
@@ -17,12 +17,12 @@
#include "util.h"
#include "test.h"
+#include <sys/stat.h>
#ifdef _WIN32
#include <fcntl.h>
#include <share.h>
#else
#include <sys/types.h>
-#include <sys/stat.h>
#include <unistd.h>
#endif
diff --git a/src/deps_log_test.cc b/src/deps_log_test.cc
index 4fa4008..30cada2 100644
--- a/src/deps_log_test.cc
+++ b/src/deps_log_test.cc
@@ -14,9 +14,9 @@
#include "deps_log.h"
+#include <sys/stat.h>
#ifndef _WIN32
#include <unistd.h>
-#include <sys/stat.h>
#endif
#include "graph.h"
diff --git a/src/getopt.c b/src/getopt.c
index 75ef99c..3350fb9 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -299,7 +299,7 @@ getopt_internal (int argc, char **argv, char *shortopts,
return (optopt = '?');
}
has_arg = ((cp[1] == ':')
- ? ((cp[2] == ':') ? OPTIONAL_ARG : REQUIRED_ARG) : no_argument);
+ ? ((cp[2] == ':') ? OPTIONAL_ARG : required_argument) : no_argument);
possible_arg = argv[optind] + optwhere + 1;
optopt = *cp;
}
@@ -318,7 +318,7 @@ getopt_internal (int argc, char **argv, char *shortopts,
else
optarg = NULL;
break;
- case REQUIRED_ARG:
+ case required_argument:
if (*possible_arg == '=')
possible_arg++;
if (*possible_arg != '\0')
diff --git a/src/getopt.h b/src/getopt.h
index ead9878..b4247fb 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -4,9 +4,9 @@
/* include files needed by this include file */
/* macros defined by this include file */
-#define no_argument 0
-#define REQUIRED_ARG 1
-#define OPTIONAL_ARG 2
+#define no_argument 0
+#define required_argument 1
+#define OPTIONAL_ARG 2
/* types defined by this include file */
diff --git a/src/includes_normalize_test.cc b/src/includes_normalize_test.cc
index cf4a4a3..d9d21bf 100644
--- a/src/includes_normalize_test.cc
+++ b/src/includes_normalize_test.cc
@@ -14,6 +14,8 @@
#include "includes_normalize.h"
+#include <direct.h>
+
#include "test.h"
#include "util.h"
diff --git a/src/test.cc b/src/test.cc
index ed2b910..560ef3a 100644
--- a/src/test.cc
+++ b/src/test.cc
@@ -12,22 +12,25 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#ifdef _WIN32
+#include <direct.h> // Has to be before util.h is included.
+#endif
+
#include "test.h"
#include <algorithm>
#include <errno.h>
-
-#include "build_log.h"
-#include "manifest_parser.h"
-#include "util.h"
-
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
+#include "build_log.h"
+#include "manifest_parser.h"
+#include "util.h"
+
namespace {
#ifdef _WIN32