summaryrefslogtreecommitdiffstats
path: root/llvm/runtime
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-04-29 08:56:07 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-04-29 08:56:07 +0000
commitdbad1d1599ad0cadbb5ce3ebc0a7cb8ddbc5e190 (patch)
treed1b7d357802cbeb0c2877d6225cb2afdd1bddd8d /llvm/runtime
parentf0e3f044709f87f56a5147ccf091cbdff035c762 (diff)
downloadbcm5719-llvm-dbad1d1599ad0cadbb5ce3ebc0a7cb8ddbc5e190.tar.gz
bcm5719-llvm-dbad1d1599ad0cadbb5ce3ebc0a7cb8ddbc5e190.zip
Unbreak the MSVC build:
- unistd.h doesn't exist with MSVC - inline must be __inline in Microsoft C - atexit cannot take a function declared as void f(), must be void f(void). llvm-svn: 130490
Diffstat (limited to 'llvm/runtime')
-rw-r--r--llvm/runtime/libprofile/CommonProfiling.c4
-rw-r--r--llvm/runtime/libprofile/PathProfiling.c14
2 files changed, 15 insertions, 3 deletions
diff --git a/llvm/runtime/libprofile/CommonProfiling.c b/llvm/runtime/libprofile/CommonProfiling.c
index 1c1771c3063..210a5e5ab78 100644
--- a/llvm/runtime/libprofile/CommonProfiling.c
+++ b/llvm/runtime/libprofile/CommonProfiling.c
@@ -19,7 +19,11 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
+#else
+#include <io.h>
+#endif
#include <stdlib.h>
static char *SavedArgs = 0;
diff --git a/llvm/runtime/libprofile/PathProfiling.c b/llvm/runtime/libprofile/PathProfiling.c
index 3008db9c4a6..161dfa0b240 100644
--- a/llvm/runtime/libprofile/PathProfiling.c
+++ b/llvm/runtime/libprofile/PathProfiling.c
@@ -16,13 +16,21 @@
#include "Profiling.h"
#include "llvm/Analysis/ProfileInfoTypes.h"
#include <sys/types.h>
-#include <unistd.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
+// Must use __inline in Microsoft C
+#if defined(_MSC_VER)
+#define inline __inline
+#endif
+
/* note that this is used for functions with large path counts,
but it is unlikely those paths will ALL be executed */
#define ARBITRARY_HASH_BIN_COUNT 100
@@ -215,7 +223,7 @@ void llvm_decrement_path_count (uint32_t functionNumber, uint32_t pathNumber) {
* +-----------------+-----------------+
*
*/
-static void pathProfAtExitHandler() {
+static void pathProfAtExitHandler(void) {
int outFile = getOutFile();
uint32_t i;
uint32_t header[2] = { PathInfo, 0 };
OpenPOWER on IntegriCloud