OSDN Git Service

[benchmark] Cherrypick fix for MinGW/ARM from upstream
authorMartin Storsjo <martin@martin.st>
Wed, 19 Sep 2018 14:30:45 +0000 (14:30 +0000)
committerMartin Storsjo <martin@martin.st>
Wed, 19 Sep 2018 14:30:45 +0000 (14:30 +0000)
This fixes building for Windows on ARM, with MinGW headers.
(Building for Windows on ARM with Windows SDK still is unsupported
by the benchmark library.)

Differential Revision: https://reviews.llvm.org/D52262

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342549 91177308-0d34-0410-b5e6-96231b3b80d8

utils/benchmark/README.LLVM
utils/benchmark/src/cycleclock.h
utils/benchmark/src/internal_macros.h

index b425ec7..0121b14 100644 (file)
@@ -17,3 +17,5 @@ Changes:
   is applied to fix 32-bit build failure on macOS
 * https://github.com/google/benchmark/commit/52613079824ac58d06c070aa9fbbb186a5859e2c
   is applied to fix cross compilation with MinGW headers
+* https://github.com/google/benchmark/commit/439d6b1c2a6da5cb6adc4c4dfc555af235722396
+  is applied to fix building with MinGW headers for ARM
index 3b376ac..e1f18cc 100644 (file)
@@ -41,7 +41,7 @@ extern "C" uint64_t __rdtsc();
 #pragma intrinsic(__rdtsc)
 #endif
 
-#ifndef BENCHMARK_OS_WINDOWS
+#if !defined(BENCHMARK_OS_WINDOWS) || defined(BENCHMARK_OS_MINGW)
 #include <sys/time.h>
 #include <time.h>
 #endif
index 3c1cda3..f2d54bf 100644 (file)
@@ -35,6 +35,9 @@
   #define BENCHMARK_OS_CYGWIN 1
 #elif defined(_WIN32)
   #define BENCHMARK_OS_WINDOWS 1
+  #if defined(__MINGW32__)
+    #define BENCHMARK_OS_MINGW 1
+  #endif
 #elif defined(__APPLE__)
   #define BENCHMARK_OS_APPLE 1
   #include "TargetConditionals.h"