Unbreak the MSVC build:
authorFrancois Pichet <pichet2000@gmail.com>
Fri, 29 Apr 2011 08:56:07 +0000 (08:56 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Fri, 29 Apr 2011 08:56:07 +0000 (08:56 +0000)
  - 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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130490 91177308-0d34-0410-b5e6-96231b3b80d8

runtime/libprofile/CommonProfiling.c
runtime/libprofile/PathProfiling.c

index 1c1771c3063e1410bad28a16a5ccbf6918fcfcd8..210a5e5ab78ae67920bbd92914e906253ea3d195 100644 (file)
 #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;
index 3008db9c4a6070b7a65c5f56854bdbeb9f398125..161dfa0b24064c7335e3cb067b0b485e69add90e 100644 (file)
 #include "Profiling.h"
 #include "llvm/Analysis/ProfileInfoTypes.h"
 #include <sys/types.h>
-#include <unistd.h>
+#if !defined(_MSC_VER) && !defined(__MINGW32__)\r
+#include <unistd.h>\r
+#else\r
+#include <io.h>\r
+#endif\r
 #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)\r
+#define inline __inline\r
+#endif\r
+
 /* 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 };