From ac113255067ff547f565e59385e56bc6f96b2b97 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Wed, 30 Nov 2016 16:32:54 +0000 Subject: [PATCH] [LibFuzzer] Add macro flags for Posix and Windows. This is the beginning of an effort to get libfuzzer working on Windows. This is a NFC to just add some macros for platform detection on Windows. Patch by Marcos Pividori Differential Revision: https://reviews.llvm.org/D27229 llvm-svn: 288249 --- lib/Fuzzer/FuzzerDefs.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Fuzzer/FuzzerDefs.h b/lib/Fuzzer/FuzzerDefs.h index 287e23c7afd..13aa212c96c 100644 --- a/lib/Fuzzer/FuzzerDefs.h +++ b/lib/Fuzzer/FuzzerDefs.h @@ -20,15 +20,23 @@ // Platform detection. #ifdef __linux__ -#define LIBFUZZER_LINUX 1 #define LIBFUZZER_APPLE 0 +#define LIBFUZZER_LINUX 1 +#define LIBFUZZER_WINDOWS 0 #elif __APPLE__ -#define LIBFUZZER_LINUX 0 #define LIBFUZZER_APPLE 1 +#define LIBFUZZER_LINUX 0 +#define LIBFUZZER_WINDOWS 0 +#elif _WIN32 +#define LIBFUZZER_APPLE 0 +#define LIBFUZZER_LINUX 0 +#define LIBFUZZER_WINDOWS 1 #else #error "Support for your platform has not been implemented" #endif +#define LIBFUZZER_POSIX LIBFUZZER_APPLE || LIBFUZZER_LINUX + #ifdef __x86_64 #define ATTRIBUTE_TARGET_POPCNT __attribute__((target("popcnt"))) #else