[PATCH] D51914: [ASan] [Windows] Avoid including windows.h in asan_malloc_win.cc

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 11 00:31:07 PDT 2018


mstorsjo created this revision.
mstorsjo added reviewers: rnk, morehouse, timurrrr.
Herald added subscribers: Sanitizers, kubamracek.

Instead provide manual declarations of the used types, to avoid pulling in conflicting declarations of some of the functions that are to be overridden.

This is an alternative to https://reviews.llvm.org/D51879.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D51914

Files:
  lib/asan/asan_malloc_win.cc


Index: lib/asan/asan_malloc_win.cc
===================================================================
--- lib/asan/asan_malloc_win.cc
+++ lib/asan/asan_malloc_win.cc
@@ -15,7 +15,18 @@
 #include "sanitizer_common/sanitizer_platform.h"
 #if SANITIZER_WINDOWS
 #define WIN32_LEAN_AND_MEAN
-#include <windows.h>
+
+// Intentionally not including windows.h here, to avoid the risk of
+// pulling in conflicting declarations of these functions. (With mingw-w64,
+// there's a risk of windows.h pulling in stdint.h.)
+typedef int BOOL;
+typedef void *HANDLE;
+typedef const void *LPCVOID;
+typedef void *LPVOID;
+
+#define HEAP_ZERO_MEMORY           0x00000008
+#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
+
 
 #include "asan_allocator.h"
 #include "asan_interceptors.h"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51914.164815.patch
Type: text/x-patch
Size: 768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180911/59fcc7e5/attachment.bin>


More information about the llvm-commits mailing list