summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util/gcc-python-plugin/files/gcc-python-plugin-cpp-compilation.diff')
-rw-r--r--dev-util/gcc-python-plugin/files/gcc-python-plugin-cpp-compilation.diff107
1 files changed, 107 insertions, 0 deletions
diff --git a/dev-util/gcc-python-plugin/files/gcc-python-plugin-cpp-compilation.diff b/dev-util/gcc-python-plugin/files/gcc-python-plugin-cpp-compilation.diff
new file mode 100644
index 0000000..f020425
--- /dev/null
+++ b/dev-util/gcc-python-plugin/files/gcc-python-plugin-cpp-compilation.diff
@@ -0,0 +1,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;