[PATCH] A fix for platform-dependent types in sanitizers' profiling support lib on x64 FreeBSD in 32-bit mode
Viktor Kutuzov
vkutuzov at accesssoftek.com
Mon Feb 24 08:53:49 PST 2014
Updated as suggested.
It seems ##defined(__i386__)## express the intention in a more explicit manner than ##!defined(__x86_64__)##.
Hi kcc, samsonov, nicholas, joerg, chandlerc,
http://llvm-reviews.chandlerc.com/D2866
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2866?vs=7307&id=7320#toc
Files:
lib/profile/GCDAProfiling.c
lib/profile/PGOProfiling.c
Index: lib/profile/GCDAProfiling.c
===================================================================
--- lib/profile/GCDAProfiling.c
+++ lib/profile/GCDAProfiling.c
@@ -25,18 +25,25 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
#include <sys/mman.h>
-#include <sys/types.h>
#ifdef _WIN32
#include <direct.h>
#endif
-#ifndef _MSC_VER
-#include <stdint.h>
-#else
+#if defined(_MSC_VER)
typedef unsigned int uint32_t;
typedef unsigned int uint64_t;
+#elif defined(__FreeBSD__) && defined(__i386__)
+// System headers define 'size_t' incorrectly on x64 FreeBSD (prior to
+// FreeBSD 10, r232261) when compiled in 32-bit mode.
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+int mkdir(const char*, unsigned short);
+#else
+#include <stdint.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#endif
/* #define DEBUG_GCDAPROFILING */
Index: lib/profile/PGOProfiling.c
===================================================================
--- lib/profile/PGOProfiling.c
+++ lib/profile/PGOProfiling.c
@@ -7,15 +7,22 @@
|*
\*===----------------------------------------------------------------------===*/
-#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
-#ifndef _MSC_VER
-#include <stdint.h>
-#else
+#if defined(_MSC_VER)
+#include <inttypes.h>
typedef unsigned int uint32_t;
typedef unsigned int uint64_t;
+#elif defined(__FreeBSD__) && defined(__i386__)
+// System headers define 'size_t' incorrectly on x64 FreeBSD (prior to
+// FreeBSD 10, r232261) when compiled in 32-bit mode.
+#define PRIu64 "llu"
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+#else
+#include <inttypes.h>
+#include <stdint.h>
#endif
static FILE *OutputFile = NULL;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2866.2.patch
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140224/622e1ef4/attachment.bin>
More information about the llvm-commits
mailing list