aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Pranskevichus <elvis@magic.io>2018-03-30 20:03:12 -0400
committerElvis Pranskevichus <elvis@magic.io>2018-03-30 20:50:11 -0400
commit3695b486d68b78ceba993efe21fda52f44252cdd (patch)
tree4e769dd77a9d4b62c9bca499fc14d33aba22e7ac
parent0f8c9661935e23a6c908504ac1208292bd55ab12 (diff)
downloadimmutables-3695b486d68b78ceba993efe21fda52f44252cdd.tar.gz
immutables-3695b486d68b78ceba993efe21fda52f44252cdd.zip
Fix compilation errors
-rw-r--r--immutables/_map.c18
-rw-r--r--immutables/_map.h15
-rw-r--r--setup.py4
3 files changed, 19 insertions, 18 deletions
diff --git a/immutables/_map.c b/immutables/_map.c
index 5c8bc42..e1efe19 100644
--- a/immutables/_map.c
+++ b/immutables/_map.c
@@ -1860,7 +1860,7 @@ map_node_array_without(MapNode_Array *self,
continue;
}
- bitmap |= 1 << i;
+ bitmap |= 1u << i;
if (IS_BITMAP_NODE(node)) {
MapNode_Bitmap *child = (MapNode_Bitmap *)node;
@@ -2188,8 +2188,8 @@ map_iterator_bitmap_next(MapIteratorState *iter,
if (node->b_array[pos] == NULL) {
iter->i_pos[level] = pos + 2;
- int8_t next_level = level + 1;
- assert(next_level < _Py_HAMT_MAX_TREE_DEPTH);
+ assert(level + 1 < _Py_HAMT_MAX_TREE_DEPTH);
+ int8_t next_level = (int8_t)(level + 1);
iter->i_level = next_level;
iter->i_pos[next_level] = 0;
iter->i_nodes[next_level] = (MapNode *)
@@ -2250,8 +2250,8 @@ map_iterator_array_next(MapIteratorState *iter,
if (node->a_array[i] != NULL) {
iter->i_pos[level] = i + 1;
- int8_t next_level = level + 1;
- assert(next_level < _Py_HAMT_MAX_TREE_DEPTH);
+ assert((level + 1) < _Py_HAMT_MAX_TREE_DEPTH);
+ int8_t next_level = (int8_t)(level + 1);
iter->i_pos[next_level] = 0;
iter->i_nodes[next_level] = node->a_array[i];
iter->i_level = next_level;
@@ -2884,7 +2884,7 @@ static PyMappingMethods Map_as_mapping = {
};
PyTypeObject _Map_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
"Map",
sizeof(MapObject),
.tp_methods = Map_methods,
@@ -2907,7 +2907,7 @@ PyTypeObject _Map_Type = {
PyTypeObject _Map_ArrayNode_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
"map_array_node",
sizeof(MapNode_Array),
0,
@@ -2920,7 +2920,7 @@ PyTypeObject _Map_ArrayNode_Type = {
};
PyTypeObject _Map_BitmapNode_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
"map_bitmap_node",
sizeof(MapNode_Bitmap) - sizeof(PyObject *),
sizeof(PyObject *),
@@ -2933,7 +2933,7 @@ PyTypeObject _Map_BitmapNode_Type = {
};
PyTypeObject _Map_CollisionNode_Type = {
- PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ PyVarObject_HEAD_INIT(NULL, 0)
"map_collision_node",
sizeof(MapNode_Collision) - sizeof(PyObject *),
sizeof(PyObject *),
diff --git a/immutables/_map.h b/immutables/_map.h
index 20999d7..41cfa13 100644
--- a/immutables/_map.h
+++ b/immutables/_map.h
@@ -1,6 +1,7 @@
#ifndef IMMUTABLES_MAP_H
#define IMMUTABLES_MAP_H
+#include <stdint.h>
#include "Python.h"
#define _Py_HAMT_MAX_TREE_DEPTH 7
@@ -59,13 +60,13 @@ typedef struct {
} MapIterator;
-PyAPI_DATA(PyTypeObject) _Map_Type;
-PyAPI_DATA(PyTypeObject) _Map_ArrayNode_Type;
-PyAPI_DATA(PyTypeObject) _Map_BitmapNode_Type;
-PyAPI_DATA(PyTypeObject) _Map_CollisionNode_Type;
-PyAPI_DATA(PyTypeObject) _MapKeys_Type;
-PyAPI_DATA(PyTypeObject) _MapValues_Type;
-PyAPI_DATA(PyTypeObject) _MapItems_Type;
+PyTypeObject _Map_Type;
+PyTypeObject _Map_ArrayNode_Type;
+PyTypeObject _Map_BitmapNode_Type;
+PyTypeObject _Map_CollisionNode_Type;
+PyTypeObject _MapKeys_Type;
+PyTypeObject _MapValues_Type;
+PyTypeObject _MapItems_Type;
#endif
diff --git a/setup.py b/setup.py
index ebf884b..b32ab17 100644
--- a/setup.py
+++ b/setup.py
@@ -5,9 +5,9 @@ import setuptools
VERSION = '0.1'
CFLAGS = ['-O2']
-
if platform.uname().system != 'Windows':
- CFLAGS.extend(['-fsigned-char', '-Wall', '-Wsign-compare', '-Wconversion'])
+ CFLAGS.extend(['-std=c99', '-fsigned-char', '-Wall',
+ '-Wsign-compare', '-Wconversion'])
setuptools.setup(