Index: third_party/tcmalloc/chromium/src/windows/port.h |
diff --git a/third_party/tcmalloc/chromium/src/windows/port.h b/third_party/tcmalloc/chromium/src/windows/port.h |
index 0faba01c2cac52798bce505ef4798cde21a3c385..e9a020656b36fd63ea3251de42a8d0bc4a0e2900 100644 |
--- a/third_party/tcmalloc/chromium/src/windows/port.h |
+++ b/third_party/tcmalloc/chromium/src/windows/port.h |
@@ -65,14 +65,15 @@ |
/* |
* 4018: signed/unsigned mismatch is common (and ok for signed_i < unsigned_i) |
- * 4244: otherwise we get problems when substracting two size_t's to an int |
+ * 4244: otherwise we get problems when subtracting two size_t's to an int |
* 4288: VC++7 gets confused when a var is defined in a loop and then after it |
* 4267: too many false positives for "conversion gives possible data loss" |
* 4290: it's ok windows ignores the "throw" directive |
* 4996: Yes, we're ok using "unsafe" functions like vsnprintf and getenv() |
+ * 4146: internal_logging.cc intentionally negates an unsigned value |
*/ |
#ifdef _MSC_VER |
-#pragma warning(disable:4018 4244 4288 4267 4290 4996) |
+#pragma warning(disable:4018 4244 4288 4267 4290 4996 4146) |
#endif |
#ifndef __cplusplus |
@@ -165,6 +166,10 @@ EXTERN_C int perftools_pthread_once(pthread_once_t *once_control, |
#endif /* __cplusplus */ |
#endif /* HAVE_PTHREAD */ |
+inline void sched_yield(void) { |
+ Sleep(0); |
+} |
+ |
/* |
* __declspec(thread) isn't usable in a dll opened via LoadLibrary(). |
* But it doesn't work to LoadLibrary() us anyway, because of all the |
@@ -260,7 +265,7 @@ class SpinLockHolder { // Acquires a spinlock for as long as the scope lasts |
#define MAP_PRIVATE MEM_COMMIT |
#define MAP_SHARED MEM_RESERVE /* value of this #define is 100% arbitrary */ |
-#if __STDC__ |
+#if __STDC__ && !defined(__MINGW32__) |
typedef _off_t off_t; |
#endif |
@@ -372,7 +377,6 @@ inline char *getcwd(char *buf, size_t size) { |
inline int mkdir(const char *pathname, int) { |
return _mkdir(pathname); |
} |
-#endif |
inline FILE *popen(const char *command, const char *type) { |
return _popen(command, type); |
@@ -380,13 +384,14 @@ inline FILE *popen(const char *command, const char *type) { |
inline int pclose(FILE *stream) { |
return _pclose(stream); |
} |
+#endif |
EXTERN_C PERFTOOLS_DLL_DECL void WriteToStderr(const char* buf, int len); |
/* ----------------------------------- SYSTEM/PROCESS */ |
typedef int pid_t; |
-#if __STDC__ |
+#if __STDC__ && !defined(__MINGW32__) |
inline pid_t getpid(void) { return _getpid(); } |
#endif |
inline pid_t getppid(void) { return 0; } |
@@ -410,10 +415,14 @@ inline unsigned int sleep(unsigned int seconds) { |
return 0; |
} |
+// mingw64 seems to define timespec (though mingw.org mingw doesn't), |
+// protected by the _TIMESPEC_DEFINED macro. |
+#ifndef _TIMESPEC_DEFINED |
struct timespec { |
int tv_sec; |
int tv_nsec; |
}; |
+#endif |
inline int nanosleep(const struct timespec *req, struct timespec *rem) { |
Sleep(req->tv_sec * 1000 + req->tv_nsec / 1000000); |