aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstijn2017-08-14 12:32:52 +0200
committerDamien George2019-09-18 22:16:19 +1000
commit5501092776d6e2ca5c4aa901b3b226d2bb1db572 (patch)
tree3ab53e2fb50d10a70338e3e664868d0fac56de7a
parentbc86c6252ab1b9a9ee47a44d7ccc9e1a9d74f207 (diff)
mpy-cross: Make mpconfigport.h compatible with msvc compiler.
Add a copy of the required options from windows/mpconfigport.h.
-rw-r--r--mpy-cross/mpconfigport.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h
index 125303afd..314526928 100644
--- a/mpy-cross/mpconfigport.h
+++ b/mpy-cross/mpconfigport.h
@@ -96,6 +96,9 @@ typedef unsigned long mp_uint_t; // must be pointer size
#include <stdint.h>
typedef __int64 mp_int_t;
typedef unsigned __int64 mp_uint_t;
+#elif defined ( _MSC_VER ) && defined( _WIN64 )
+typedef __int64 mp_int_t;
+typedef unsigned __int64 mp_uint_t;
#else
// These are definitions for machines where sizeof(int) == sizeof(void*),
// regardless for actual size.
@@ -122,3 +125,37 @@ typedef long mp_off_t;
#endif
#include <stdint.h>
+
+// MSVC specifics - see windows/mpconfigport.h for explanation
+#ifdef _MSC_VER
+
+#define MP_ENDIANNESS_LITTLE (1)
+#define NORETURN __declspec(noreturn)
+#define MP_NOINLINE __declspec(noinline)
+#define MP_LIKELY(x) (x)
+#define MP_UNLIKELY(x) (x)
+#define MICROPY_PORT_CONSTANTS { "dummy", 0 }
+#ifdef _WIN64
+#define MP_SSIZE_MAX _I64_MAX
+#else
+#define MP_SSIZE_MAX _I32_MAX
+#endif
+#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void*)(p)) //Avoid compiler warning about different const qualifiers
+#define restrict
+#define inline __inline
+#define alignof(t) __alignof(t)
+#undef MICROPY_ALLOC_PATH_MAX
+#define MICROPY_ALLOC_PATH_MAX 260
+#define PATH_MAX MICROPY_ALLOC_PATH_MAX
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#ifdef _WIN64
+#define SSIZE_MAX _I64_MAX
+typedef __int64 ssize_t;
+#else
+#define SSIZE_MAX _I32_MAX
+typedef int ssize_t;
+#endif
+typedef mp_off_t off_t;
+
+#endif