Skip to content

Commit

Permalink
Unbreak the MSVC build:
Browse files Browse the repository at this point in the history
  - 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
  • Loading branch information
fpichet committed Apr 29, 2011
1 parent 3224806 commit b89e699
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions runtime/libprofile/CommonProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 11 additions & 3 deletions runtime/libprofile/PathProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 };
Expand Down

0 comments on commit b89e699

Please sign in to comment.