[llvm-commits] [llvm] r130490 - in /llvm/trunk/runtime/libprofile: CommonProfiling.c PathProfiling.c

Francois Pichet pichet2000 at gmail.com
Fri Apr 29 01:56:07 PDT 2011


Author: fpichet
Date: Fri Apr 29 03:56:07 2011
New Revision: 130490

URL: http://llvm.org/viewvc/llvm-project?rev=130490&view=rev
Log:
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).

Modified:
    llvm/trunk/runtime/libprofile/CommonProfiling.c
    llvm/trunk/runtime/libprofile/PathProfiling.c

Modified: llvm/trunk/runtime/libprofile/CommonProfiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/CommonProfiling.c?rev=130490&r1=130489&r2=130490&view=diff
==============================================================================
--- llvm/trunk/runtime/libprofile/CommonProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/CommonProfiling.c Fri Apr 29 03:56:07 2011
@@ -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;

Modified: llvm/trunk/runtime/libprofile/PathProfiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/PathProfiling.c?rev=130490&r1=130489&r2=130490&view=diff
==============================================================================
--- llvm/trunk/runtime/libprofile/PathProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/PathProfiling.c Fri Apr 29 03:56:07 2011
@@ -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 @@
  *      +-----------------+-----------------+
  *
  */
-static void pathProfAtExitHandler() {
+static void pathProfAtExitHandler(void) {
   int outFile = getOutFile();
   uint32_t i;
   uint32_t header[2] = { PathInfo, 0 };





More information about the llvm-commits mailing list