Author: Matti Picus <[email protected]>
Branch: vmprof-win32
Changeset: r92020:16d18de7f580
Date: 2017-08-01 23:22 +0300
http://bitbucket.org/pypy/pypy/changeset/16d18de7f580/

Log:    fix compilation on win32

diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py
--- a/rpython/rlib/rvmprof/cintf.py
+++ b/rpython/rlib/rvmprof/cintf.py
@@ -23,6 +23,8 @@
     SHARED.join('symboltable.c'),
     SHARED.join('vmprof_unix.c')
 ]
+include_dirs = [SRC, SHARED]
+
 if sys.platform.startswith('linux'):
     separate_module_files += [
        BACKTRACE.join('atomic.c'),
@@ -35,10 +37,12 @@
        BACKTRACE.join('mmapio.c'),
        BACKTRACE.join('posix.c'),
        BACKTRACE.join('sort.c'),
+       SHARED.join('vmprof_mt.c'),
     ]
     _libs = ['dl']
     compile_extra += ['-DVMPROF_UNIX']
     compile_extra += ['-DVMPROF_LINUX']
+    include_dirs.append(BACKTRACE)
 elif sys.platform == 'win32':
     compile_extra = ['-DRPYTHON_VMPROF', '-DVMPROF_WINDOWS']
     separate_module_files = [SHARED.join('vmprof_win.c')]
@@ -48,10 +52,12 @@
     compile_extra += ['-DVMPROF_UNIX']
     compile_extra += ['-DVMPROF_MAC']
     _libs = []
-
+    separate_module_files += [
+       SHARED.join('vmprof_mt.c'),
+    ]
 
 eci_kwds = dict(
-    include_dirs = [SRC, SHARED, BACKTRACE],
+    include_dirs = include_dirs,
     includes = ['rvmprof.h','vmprof_stack.h'],
     libraries = _libs,
     separate_module_files = [
@@ -59,7 +65,6 @@
         SHARED.join('compat.c'),
         SHARED.join('machine.c'),
         SHARED.join('vmp_stack.c'),
-        SHARED.join('vmprof_mt.c'),
         SHARED.join('vmprof_memory.c'),
         SHARED.join('vmprof_common.c'),
         # symbol table already in separate_module_files
diff --git a/rpython/rlib/rvmprof/src/rvmprof.h 
b/rpython/rlib/rvmprof/src/rvmprof.h
--- a/rpython/rlib/rvmprof/src/rvmprof.h
+++ b/rpython/rlib/rvmprof/src/rvmprof.h
@@ -7,9 +7,8 @@
 
 #ifdef VMPROF_WINDOWS
 #include <crtdefs.h>
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-typedef intptr_t ssize_t;
+#include "shared/msiinttypes/inttypes.h"
+#include "shared/msiinttypes/stdint.h"
 #else
 #include <inttypes.h>
 #include <stdint.h>
diff --git a/rpython/rlib/rvmprof/src/shared/machine.c 
b/rpython/rlib/rvmprof/src/shared/machine.c
--- a/rpython/rlib/rvmprof/src/shared/machine.c
+++ b/rpython/rlib/rvmprof/src/shared/machine.c
@@ -34,7 +34,7 @@
 #endif
 }
 
-long vmp_fd_to_path(int fd, char * buffer, long buffer_len)
+long vmp_fd_to_path(int fd, const char * buffer, long buffer_len)
 {
 #ifdef VMPROF_LINUX
     char proffs[24];
diff --git a/rpython/rlib/rvmprof/src/shared/machine.h 
b/rpython/rlib/rvmprof/src/shared/machine.h
--- a/rpython/rlib/rvmprof/src/shared/machine.h
+++ b/rpython/rlib/rvmprof/src/shared/machine.h
@@ -14,5 +14,5 @@
  * Writes the filename into buffer. Returns -1 if the platform is not
  * implemented.
  */
-long vmp_fd_to_path(int fd, char * buffer, long buffer_len);
+long vmp_fd_to_path(int fd, const char * buffer, long buffer_len);
 
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_common.c 
b/rpython/rlib/rvmprof/src/shared/vmprof_common.c
--- a/rpython/rlib/rvmprof/src/shared/vmprof_common.c
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_common.c
@@ -2,6 +2,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <string.h> /* for strerror */
 
 #ifdef RPYTHON_VMPROF
 #ifdef RPYTHON_LL2CTYPES
@@ -34,9 +35,11 @@
 static size_t threads_size_step = 8;
 #endif
 
+#ifndef VMPROF_WINDOWS
 int vmprof_get_itimer_type(void) {
     return itimer_type;
 }
+#endif
 
 int vmprof_is_enabled(void) {
     return is_enabled;
@@ -62,9 +65,11 @@
     profile_interval_usec = value;
 }
 
+#ifndef VMPROF_WINDOWS
 int vmprof_get_signal_type(void) {
     return signal_type;
 }
+#endif
 
 char *vmprof_init(int fd, double interval, int memory,
                   int proflines, const char *interp_name, int native, int 
real_time)
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_common.h 
b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
--- a/rpython/rlib/rvmprof/src/shared/vmprof_common.h
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
@@ -1,5 +1,6 @@
 #pragma once
 
+
 #include "vmprof.h"
 #include "machine.h"
 #include "compat.h"
@@ -8,6 +9,7 @@
 #include <time.h>
 #include <stdlib.h>
 
+
 #ifdef VMPROF_UNIX
 #include <sys/time.h>
 #include "vmprof_mt.h"
@@ -15,7 +17,9 @@
 #include <pthread.h>
 #endif
 
+#ifndef _MSC_VER
 #include "vmprof_getpc.h"
+#endif
 
 #ifdef VMPROF_LINUX
 #include <syscall.h>
@@ -109,3 +113,4 @@
 int broadcast_signal_for_threads(void);
 int is_main_thread(void);
 #endif
+
diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_memory.c 
b/rpython/rlib/rvmprof/src/shared/vmprof_memory.c
--- a/rpython/rlib/rvmprof/src/shared/vmprof_memory.c
+++ b/rpython/rlib/rvmprof/src/shared/vmprof_memory.c
@@ -14,7 +14,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#ifdef VMPROF_WINDOWS
+#include "shared/msiinttypes/stdint.h"
+#else
 #include <unistd.h>
+#endif
 #include <string.h>
 /* On '''normal''' Unices we can get RSS from '/proc/<pid>/status'. */
 static int proc_file = -1;
diff --git a/rpython/rlib/rvmprof/src/vmprof_stack.h 
b/rpython/rlib/rvmprof/src/vmprof_stack.h
--- a/rpython/rlib/rvmprof/src/vmprof_stack.h
+++ b/rpython/rlib/rvmprof/src/vmprof_stack.h
@@ -1,7 +1,7 @@
 #pragma once
 
 #ifdef _WIN32
-#define intptr_t long // XXX windows VC++ 2008 lacks stdint.h
+#include "msiinttypes/stdint.h"
 #else
 #include <unistd.h>
 #endif
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to