summaryrefslogtreecommitdiff
blob: f020425788a8030e75be4eb8e25d8d13234f4194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
diff --git a/Makefile b/Makefile
index 05c147b..56c0321 100644
--- a/Makefile
+++ b/Makefile
@@ -102,9 +102,9 @@ GCC_PYTHON_PLUGIN_SO	:= python.so
 CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -I. $(PYTHON_INCLUDES)
 # Allow user to pick optimization, choose whether warnings are fatal,
 # and choose debugging information level.
-CFLAGS?=-O2 -Werror -g
+CFLAGS?=-O2 -g
 # Force these settings
-CFLAGS+= -fPIC -fno-strict-aliasing -Wall
+CFLAGS+= -fPIC -fno-strict-aliasing -Wno-write-strings -fpermissive
 LIBS+= $(PYTHON_LIBS)
 ifneq "$(PLUGIN_PYTHONPATH)" ""
   CPPFLAGS+= -DPLUGIN_PYTHONPATH='"$(PLUGIN_PYTHONPATH)"'
diff --git a/gcc-python-wrapper.c b/gcc-python-wrapper.c
index 93feb58..c8b6ed0 100644
--- a/gcc-python-wrapper.c
+++ b/gcc-python-wrapper.c
@@ -136,10 +136,55 @@ PyTypeObject PyGccWrapperMetaType  = {
     "gcc.WrapperMeta", /*tp_name*/
     sizeof(PyGccWrapperTypeObject), /*tp_basicsize*/
     0, /*tp_itemsize*/
-
-    .tp_flags = Py_TPFLAGS_DEFAULT,
-    .tp_base = &PyType_Type,
-    .tp_new = gcc_python_wrapper_meta_tp_new,
+    NULL, /* tp_dealloc */
+    NULL, /* tp_print */
+    NULL, /* tp_getattr */
+    NULL, /* tp_setattr */
+#if PY_MAJOR_VERSION < 3
+    0, /*tp_compare*/
+#else
+    0, /*reserved*/
+#endif
+    NULL, /* tp_repr */
+    NULL, /* tp_as_number */
+    NULL, /* tp_as_sequence */
+    NULL, /* tp_as_mapping */
+    NULL, /* tp_hash */
+    NULL, /* tp_call */
+    NULL, /* tp_str */
+    NULL, /* tp_getattro */
+    NULL, /* tp_setattro */
+    NULL, /* tp_as_buffer */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
+    0, /*tp_doc*/
+    NULL, /* tp_traverse */
+    NULL, /* tp_clear */
+    NULL, /* tp_richcompare */
+    0, /* tp_weaklistoffset */
+    NULL, /* tp_iter */
+    NULL, /* tp_iternext */
+    NULL, /* tp_methods */
+    NULL, /* tp_members */
+    NULL, /* tp_getset */
+    &PyType_Type, /* tp_base */
+    NULL, /* tp_dict */
+    NULL, /* tp_descr_get */
+    NULL, /* tp_descr_set */
+    0, /* tp_dictoffset */
+    NULL, /* tp_init */
+    NULL, /* tp_alloc */
+    gcc_python_wrapper_meta_tp_new, /* tp_new */
+    NULL, /* tp_free */
+    NULL, /* tp_is_gc */
+    NULL, /* tp_bases */
+    NULL, /* tp_mro */
+    NULL, /* tp_cache */
+    NULL, /* tp_subclasses */
+    NULL, /* tp_weaklist */
+    NULL, /* tp_del */
+#if PY_VERSION_HEX >= 0x02060000
+    0, /*tp_version_tag*/
+#endif
 };
 
 /* Maintain a circular linked list of PyGccWrapper instances: */
diff --git a/gcc-python.c b/gcc-python.c
index f037988..5421181 100644
--- a/gcc-python.c
+++ b/gcc-python.c
@@ -81,11 +81,11 @@ gcc_python_define_macro(PyObject *self,
                         PyObject *args, PyObject *kwargs)
 {
     const char *macro;
-    char *keywords[] = {"macro",
+    const char *keywords[] = {"macro",
                         NULL};
 
     if (!PyArg_ParseTupleAndKeywords(args, kwargs,
-                                     "s:define_preprocessor_name", keywords,
+                                     "s:define_preprocessor_name", (char**)keywords,
                                      &macro)) {
         return NULL;
     }
@@ -463,7 +463,7 @@ static struct PyModuleDef gcc_module_def = {
 };
 #endif
 
-static PyMODINIT_FUNC PyInit_gcc(void)
+PyMODINIT_FUNC PyInit_gcc(void)
 {
 #if PY_MAJOR_VERSION == 3
     PyObject *m;