Skip to content

Commit c656a28

Browse files
committed
[GR-42006] Make jni build work on Windows
1 parent 349135f commit c656a28

File tree

20 files changed

+92
-50
lines changed

20 files changed

+92
-50
lines changed

graalpython/com.oracle.graal.python.cext/include/cpython/code.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,13 @@ PyAPI_FUNC(int) _PyCode_SetExtra(PyObject *code, Py_ssize_t index,
181181
void *extra);
182182

183183
/** API for initializing the line number table. */
184-
int _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
184+
PyAPI_FUNC(int) _PyCode_InitAddressRange(PyCodeObject* co, PyCodeAddressRange *bounds);
185185

186186
/** Out of process API for initializing the line number table. */
187-
void PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
187+
PyAPI_FUNC(void) PyLineTable_InitAddressRange(const char *linetable, Py_ssize_t length, int firstlineno, PyCodeAddressRange *range);
188188

189189
/** API for traversing the line number table. */
190-
int PyLineTable_NextAddressRange(PyCodeAddressRange *range);
191-
int PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
190+
PyAPI_FUNC(int) PyLineTable_NextAddressRange(PyCodeAddressRange *range);
191+
PyAPI_FUNC(int) PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
192192

193193

graalpython/com.oracle.graal.python.cext/include/cpython/dictobject.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key,
4545
Py_hash_t hash);
4646
PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
4747
int (*predicate)(PyObject *value));
48-
PyDictKeysObject *_PyDict_NewKeysForClass(void);
48+
PyAPI_FUNC(PyDictKeysObject *) _PyDict_NewKeysForClass(void);
4949
PyAPI_FUNC(int) _PyDict_Next(
5050
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
5151

@@ -56,11 +56,11 @@ PyAPI_FUNC(int) _PyDict_ContainsId(PyObject *, struct _Py_Identifier *);
5656
PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused);
5757
PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp);
5858
PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp);
59-
Py_ssize_t _PyDict_KeysSize(PyDictKeysObject *keys);
59+
PyAPI_FUNC(Py_ssize_t) _PyDict_KeysSize(PyDictKeysObject *keys);
6060
PyAPI_FUNC(Py_ssize_t) _PyDict_SizeOf(PyDictObject *);
6161
PyAPI_FUNC(PyObject *) _PyDict_Pop(PyObject *, PyObject *, PyObject *);
62-
PyObject *_PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *);
63-
PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
62+
PyAPI_FUNC(PyObject *) _PyDict_Pop_KnownHash(PyObject *, PyObject *, Py_hash_t, PyObject *);
63+
PyAPI_FUNC(PyObject *) _PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
6464
#define _PyDict_HasSplitTable(d) ((d)->ma_values != NULL)
6565

6666
/* Like PyDict_Merge, but override can be 0, 1 or 2. If override is 0,
@@ -74,9 +74,9 @@ PyAPI_FUNC(int) _PyDict_SetItemId(PyObject *dp, struct _Py_Identifier *key, PyOb
7474
PyAPI_FUNC(int) _PyDict_DelItemId(PyObject *mp, struct _Py_Identifier *key);
7575
PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
7676

77-
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
78-
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
79-
Py_ssize_t _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);
77+
PyAPI_FUNC(int) _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
78+
PyAPI_FUNC(PyObject *) _PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
79+
PyAPI_FUNC(Py_ssize_t) _PyDict_GetItemHint(PyDictObject *, PyObject *, Py_ssize_t, PyObject **);
8080

8181
/* _PyDictView */
8282

graalpython/com.oracle.graal.python.cext/include/cpython/frameobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
7676
PyObject *, PyObject *);
7777

7878
/* only internal use */
79-
PyFrameObject*
79+
PyAPI_FUNC(PyFrameObject*)
8080
_PyFrame_New_NoTrack(PyThreadState *, PyFrameConstructor *, PyObject *);
8181

8282

graalpython/com.oracle.graal.python.cext/include/cpython/pyerrors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(
145145

146146
/* In signalmodule.c */
147147

148-
int PySignal_SetWakeupFd(int fd);
148+
PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
149149
PyAPI_FUNC(int) _PyErr_CheckSignals(void);
150150

151151
/* Support for adding program text to SyntaxErrors */

graalpython/com.oracle.graal.python.cext/include/datetime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ typedef struct
119119
} PyDateTime_DateTime; /* hastzinfo true */
120120

121121

122-
PyObject* PyTruffle_PyDateTime_GET_TZINFO(PyObject*);
122+
PyAPI_FUNC(PyObject*) PyTruffle_PyDateTime_GET_TZINFO(PyObject*);
123123

124124
/* Apply for date and datetime instances. */
125125

graalpython/com.oracle.graal.python.cext/include/genobject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
4747
PyObject *name, PyObject *qualname);
4848
PyAPI_FUNC(int) _PyGen_SetStopIterationValue(PyObject *);
4949
PyAPI_FUNC(int) _PyGen_FetchStopIterationValue(PyObject **);
50-
PyObject *_PyGen_yf(PyGenObject *);
50+
PyAPI_FUNC(PyObject *) _PyGen_yf(PyGenObject *);
5151
PyAPI_FUNC(void) _PyGen_Finalize(PyObject *self);
5252

5353
#ifndef Py_LIMITED_API
@@ -60,7 +60,7 @@ PyAPI_DATA(PyTypeObject) PyCoro_Type;
6060
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
6161

6262
#define PyCoro_CheckExact(op) Py_IS_TYPE(op, &PyCoro_Type)
63-
PyObject *_PyCoro_GetAwaitableIter(PyObject *o);
63+
PyAPI_FUNC(PyObject *) _PyCoro_GetAwaitableIter(PyObject *o);
6464
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
6565
PyObject *name, PyObject *qualname);
6666

@@ -92,7 +92,7 @@ PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
9292

9393
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE(op, &PyAsyncGen_Type)
9494

95-
PyObject *_PyAsyncGenValueWrapperNew(PyObject *);
95+
PyAPI_FUNC(PyObject *) _PyAsyncGenValueWrapperNew(PyObject *);
9696

9797
#endif
9898

graalpython/com.oracle.graal.python.cext/include/modsupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ PyAPI_FUNC(PyObject * const *) _PyArg_UnpackKeywords(
138138
_PyArg_UnpackKeywords((args), (nargs), (kwargs), (kwnames), (parser), \
139139
(minpos), (maxpos), (minkw), (buf)))
140140

141-
void _PyArg_Fini(void);
141+
PyAPI_FUNC(void) _PyArg_Fini(void);
142142
#endif /* Py_LIMITED_API */
143143

144144
// Add an attribute with name 'name' and value 'obj' to the module 'mod.

graalpython/com.oracle.graal.python.cext/include/pyconfig.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@
7474
// required for __UINT32_MAX__ etc.
7575
#include <limits.h>
7676

77+
#if defined(_MSC_VER) && !defined(__clang__)
78+
// defines based on MSVC documentation
79+
#define __SIZEOF_INT__ 4
80+
#define __SIZEOF_SHORT__ 2
81+
#define __SIZEOF_LONG__ 4
82+
#define __SIZEOF_LONG_LONG__ 8
83+
#define __SIZEOF_INT128__ 16
84+
#define __SIZEOF_FLOAT__ 4
85+
#define __SIZEOF_DOUBLE__ 8
86+
#define __SIZEOF_LONG_DOUBLE__ 8
87+
#define __SIZEOF_SIZE_T__ 8
88+
#define __SIZEOF_UINTPTR_T__ 8
89+
#define __SIZEOF_POINTER__ 8
90+
#define __SIZEOF_WCHAR_T__ 2
91+
#endif
92+
7793
// defines based on Clang defines
7894
#define SIZEOF_DOUBLE __SIZEOF_DOUBLE__
7995
#define SIZEOF_FLOAT __SIZEOF_FLOAT__
@@ -140,6 +156,9 @@
140156
#define HAVE_SYS_WAIT_H
141157
#define TIME_WITH_SYS_TIME 1
142158
#else
159+
#define HAVE_COPYSIGN 1
160+
#define HAVE_ROUND 1
161+
#define HAVE_HYPOT 1
143162
#define NT_THREADS 1
144163
#endif
145164

graalpython/com.oracle.graal.python.cext/include/warnings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ PyErr_WarnExplicitFormat(PyObject *category,
6262
#endif
6363

6464
#ifndef Py_LIMITED_API
65-
void _PyErr_WarnUnawaitedCoroutine(PyObject *coro);
65+
PyAPI_FUNC(void) _PyErr_WarnUnawaitedCoroutine(PyObject *coro);
6666
#endif
6767

6868
#ifdef __cplusplus

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,11 +1350,11 @@ PyAPI_FUNC(void) truffle_set_tp_flags(PyTypeObject* type, unsigned long flags) {
13501350
type->tp_flags = flags;
13511351
}
13521352

1353-
int truffle_BASETYPE_check(PyObject* type) {
1353+
PyAPI_FUNC(int) truffle_BASETYPE_check(PyObject* type) {
13541354
return PyType_HasFeature(Py_TYPE(type), Py_TPFLAGS_BASETYPE);
13551355
}
13561356

1357-
void* truffle_get_constant(int entry) {
1357+
PyAPI_FUNC(void*) truffle_get_constant(int entry) {
13581358
// this needs to correspond to CApiContext.resolveConstant
13591359
switch(entry) {
13601360
case 0:

0 commit comments

Comments
 (0)