From 2a83c9fee40571e92984da56de095e70a6b12a05 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 13:41:02 -0400 Subject: [PATCH 1/4] Fix some compiler warnings --- extern/qhull/global.c | 1 - lib/matplotlib/tri/_tri_wrapper.cpp | 3 --- src/_contour_wrapper.cpp | 3 --- 3 files changed, 7 deletions(-) diff --git a/extern/qhull/global.c b/extern/qhull/global.c index 90f956d7e885..1adadf86b80a 100644 --- a/extern/qhull/global.c +++ b/extern/qhull/global.c @@ -1843,7 +1843,6 @@ void qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile) { time_t timedata; int seed; - qh_CPUclock; /* start the clock(for qh_clock). One-shot. */ #if qh_QHpointer memset((char *)qh_qh, 0, sizeof(qhT)); /* every field is 0, FALSE, NULL */ #else diff --git a/lib/matplotlib/tri/_tri_wrapper.cpp b/lib/matplotlib/tri/_tri_wrapper.cpp index 99e04bc8966f..57444f5c9457 100644 --- a/lib/matplotlib/tri/_tri_wrapper.cpp +++ b/lib/matplotlib/tri/_tri_wrapper.cpp @@ -480,10 +480,7 @@ extern "C" { struct module_state { -/* The Sun compiler can't handle empty structs */ -#if defined(__SUNPRO_C) || defined(_MSC_VER) int _dummy; -#endif }; #if PY3K diff --git a/src/_contour_wrapper.cpp b/src/_contour_wrapper.cpp index 70ceb917fd1c..64bbd28fa559 100644 --- a/src/_contour_wrapper.cpp +++ b/src/_contour_wrapper.cpp @@ -140,10 +140,7 @@ extern "C" { struct module_state { -/* The Sun compiler can't handle empty structs */ -#if defined(__SUNPRO_C) || defined(_MSC_VER) int _dummy; -#endif }; #if PY3K From 2f2d79fc02de4c025dc339ba375fef60ff76dd76 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 15:26:05 -0400 Subject: [PATCH 2/4] Revert change. Didn't mean to modify extern --- extern/qhull/global.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extern/qhull/global.c b/extern/qhull/global.c index 1adadf86b80a..90f956d7e885 100644 --- a/extern/qhull/global.c +++ b/extern/qhull/global.c @@ -1843,6 +1843,7 @@ void qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile) { time_t timedata; int seed; + qh_CPUclock; /* start the clock(for qh_clock). One-shot. */ #if qh_QHpointer memset((char *)qh_qh, 0, sizeof(qhT)); /* every field is 0, FALSE, NULL */ #else From f1c9c07bfd2c41dfc59b32952a43f26954922d44 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 20 Oct 2015 15:34:51 -0400 Subject: [PATCH 3/4] More compiler warnings from gcc --- lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp | 8 +++++--- src/_path_wrapper.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp b/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp index 8f72b3694d7a..1f349e4727a3 100644 --- a/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp +++ b/lib/matplotlib/delaunay/VoronoiDiagramGenerator.cpp @@ -766,9 +766,8 @@ void VoronoiDiagramGenerator::out_vertex(struct Site *v) void VoronoiDiagramGenerator::out_site(struct Site *s) { - if(!triangulate & plot & !debug) + if(!triangulate && plot && !debug) circle (s->coord.x, s->coord.y, cradius); - } @@ -932,7 +931,10 @@ bool VoronoiDiagramGenerator::voronoi(int triangulate) if(!retval) return false; - + + newintstar.x = 0; + newintstar.y = 0; + newsite = nextone(); while(1) { diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index 18469c5cb46a..d327a12180b9 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -79,7 +79,7 @@ static PyObject *Py_points_in_path(PyObject *self, PyObject *args, PyObject *kwd return NULL; } - npy_intp dims[] = { points.size() }; + npy_intp dims[] = { (npy_intp)points.size() }; numpy::array_view results(dims); CALL_CPP("points_in_path", (points_in_path(points, r, path, trans, results))); @@ -138,7 +138,7 @@ static PyObject *Py_points_on_path(PyObject *self, PyObject *args, PyObject *kwd return NULL; } - npy_intp dims[] = { points.size() }; + npy_intp dims[] = { (npy_intp)points.size() }; numpy::array_view results(dims); CALL_CPP("points_on_path", (points_on_path(points, r, path, trans, results))); @@ -437,7 +437,7 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *k try { numpy::array_view vertices(vertices_obj); - npy_intp dims[] = { vertices.size(), 2 }; + npy_intp dims[] = { (npy_intp)vertices.size(), 2 }; numpy::array_view result(dims); CALL_CPP("affine_transform", (affine_transform_2d(vertices, trans, result))); return result.pyobj(); @@ -445,7 +445,7 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args, PyObject *k PyErr_Clear(); try { numpy::array_view vertices(vertices_obj); - npy_intp dims[] = { vertices.size() }; + npy_intp dims[] = { (npy_intp)vertices.size() }; numpy::array_view result(dims); CALL_CPP("affine_transform", (affine_transform_1d(vertices, trans, result))); return result.pyobj(); From 43e2d0bd758bf1af1d1b395040306dd1602822cb Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Wed, 21 Oct 2015 11:38:33 -0400 Subject: [PATCH 4/4] Don't need module_state struct at all --- lib/matplotlib/tri/_tri_wrapper.cpp | 7 +------ src/_backend_agg_wrapper.cpp | 7 +------ src/_contour_wrapper.cpp | 7 +------ src/_gtkagg.cpp | 7 +------ src/_image_wrapper.cpp | 7 +------ src/_path_wrapper.cpp | 7 +------ src/_png.cpp | 7 +------ src/ft2font_wrapper.cpp | 19 +++++++++++-------- 8 files changed, 18 insertions(+), 50 deletions(-) diff --git a/lib/matplotlib/tri/_tri_wrapper.cpp b/lib/matplotlib/tri/_tri_wrapper.cpp index 57444f5c9457..fbcefa21612d 100644 --- a/lib/matplotlib/tri/_tri_wrapper.cpp +++ b/lib/matplotlib/tri/_tri_wrapper.cpp @@ -478,17 +478,12 @@ static PyTypeObject* PyTrapezoidMapTriFinder_init_type(PyObject* m, PyTypeObject extern "C" { -struct module_state -{ - int _dummy; -}; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_tri", NULL, - sizeof(struct module_state), + 0, NULL, NULL, NULL, diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index c1564e69ff6e..61f0e0efa67d 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -725,17 +725,12 @@ static PyTypeObject *PyRendererAgg_init_type(PyObject *m, PyTypeObject *type) extern "C" { -struct module_state -{ - int _dummy; -}; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_backend_agg", NULL, - sizeof(struct module_state), + 0, NULL, NULL, NULL, diff --git a/src/_contour_wrapper.cpp b/src/_contour_wrapper.cpp index 64bbd28fa559..03a4e2de2e9a 100644 --- a/src/_contour_wrapper.cpp +++ b/src/_contour_wrapper.cpp @@ -138,17 +138,12 @@ static PyTypeObject* PyQuadContourGenerator_init_type(PyObject* m, PyTypeObject* extern "C" { -struct module_state -{ - int _dummy; -}; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_contour", NULL, - sizeof(struct module_state), + 0, NULL, NULL, NULL, diff --git a/src/_gtkagg.cpp b/src/_gtkagg.cpp index 9e3dcf13652f..0b0f8ef4b0de 100644 --- a/src/_gtkagg.cpp +++ b/src/_gtkagg.cpp @@ -108,17 +108,12 @@ static PyMethodDef module_methods[] = { extern "C" { - struct module_state - { - int _dummy; - }; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_gtkagg", NULL, - sizeof(struct module_state), + 0, module_methods, NULL, NULL, diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index 4ffc67f944e6..d0c56d34f21f 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -728,17 +728,12 @@ static PyMethodDef module_functions[] = { extern "C" { -struct module_state -{ - int _dummy; -}; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_image", NULL, - sizeof(struct module_state), + 0, module_functions, NULL, NULL, diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index d327a12180b9..8500bab586bf 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -730,17 +730,12 @@ extern "C" { {NULL} }; - struct module_state - { - int _dummy; - }; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_path", NULL, - sizeof(struct module_state), + 0, module_functions, NULL, NULL, diff --git a/src/_png.cpp b/src/_png.cpp index 864954c7f44a..3121edbb712d 100644 --- a/src/_png.cpp +++ b/src/_png.cpp @@ -520,17 +520,12 @@ static PyMethodDef module_methods[] = { extern "C" { - struct module_state - { - int _dummy; - }; - #if PY3K static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "_png", NULL, - sizeof(struct module_state), + 0, module_methods, NULL, NULL, diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp index ab96a9c3cb6f..c2fd95798959 100644 --- a/src/ft2font_wrapper.cpp +++ b/src/ft2font_wrapper.cpp @@ -1640,15 +1640,18 @@ static PyTypeObject *PyFT2Font_init_type(PyObject *m, PyTypeObject *type) extern "C" { -struct module_state -{ - int _dummy; -}; - #if PY3K -static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "ft2font", NULL, - sizeof(struct module_state), NULL, NULL, - NULL, NULL, NULL }; +static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "ft2font", + NULL, + 0, + NULL, + NULL, + NULL, + NULL, + NULL +}; #define INITERROR return NULL