From ac047b1f7efe3e90c2759864b57fd7c0d9404313 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 18 Sep 2014 16:08:25 -0700 Subject: 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. --- src/build_log_test.cc | 2 +- src/deps_log_test.cc | 2 +- src/getopt.c | 4 ++-- src/getopt.h | 6 +++--- src/includes_normalize_test.cc | 2 ++ src/test.cc | 13 ++++++++----- 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 #ifdef _WIN32 #include #include #else #include -#include #include #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 #ifndef _WIN32 #include -#include #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 + #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 // Has to be before util.h is included. +#endif + #include "test.h" #include #include - -#include "build_log.h" -#include "manifest_parser.h" -#include "util.h" - #ifdef _WIN32 #include #else #include #endif +#include "build_log.h" +#include "manifest_parser.h" +#include "util.h" + namespace { #ifdef _WIN32 -- cgit v0.12