From ce2a880d8cdc95f09745b1dc6eb00e3a52894fba Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Sat, 19 Mar 2016 14:07:55 +0000 Subject: [PATCH 1/3] Revert "Enable the use of c99 macros in c++" This reverts commit 3818675ddf2cfdeab68f8a46ba97f5f8331f13d9. --- setupext.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setupext.py b/setupext.py index 29291b259b15..68445e958573 100755 --- a/setupext.py +++ b/setupext.py @@ -898,11 +898,6 @@ def add_flags(self, ext): ext.define_macros.append(('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION')) - # Allow the numpy NPY_INTP_FMT macro to be used in C++. - # On gcc this translates to PRIdPTR which needs - # __STDC_FORMAT_MACROS to be usable in c++ - ext.define_macros.append(('__STDC_FORMAT_MACROS', 1)) - def get_setup_requires(self): return ['numpy>=1.6'] From dc6245b92121866913462b9b3cc19ae9f5c4ee1f Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Sat, 19 Mar 2016 14:08:00 +0000 Subject: [PATCH 2/3] Revert "Use Numpy macros for formatting" This reverts commit 0c0b5dfb581626919990fed8fce48145d587e0d7. --- src/_backend_agg_wrapper.cpp | 10 +++++----- src/_image_wrapper.cpp | 2 +- src/_path_wrapper.cpp | 2 +- src/py_converters.cpp | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index e6908d3531f8..b9383245bfec 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -449,14 +449,14 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec if (points.dim(0) != 3 || points.dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "points must be a 3x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "points must be a 3x2 array, got %ldx%ld", points.dim(0), points.dim(1)); return NULL; } if (colors.dim(0) != 3 || colors.dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "colors must be a 3x4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "colors must be a 3x4 array, got %ldx%ld", colors.dim(0), colors.dim(1)); return NULL; } @@ -490,21 +490,21 @@ PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObje if (points.size() != 0 && (points.dim(1) != 3 || points.dim(2) != 2)) { PyErr_Format(PyExc_ValueError, - "points must be a Nx3x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "points must be a Nx3x2 array, got %ldx%ldx%ld", points.dim(0), points.dim(1), points.dim(2)); return NULL; } if (colors.size() != 0 && (colors.dim(1) != 3 || colors.dim(2) != 4)) { PyErr_Format(PyExc_ValueError, - "colors must be a Nx3x4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "colors must be a Nx3x4 array, got %ldx%ldx%ld", colors.dim(0), colors.dim(1), colors.dim(2)); return NULL; } if (points.size() != colors.size()) { PyErr_Format(PyExc_ValueError, - "points and colors arrays must be the same length, got %"NPY_INTP_FMT" and %"NPY_INTP_FMT, + "points and colors arrays must be the same length, got %ld and %ld", points.dim(0), colors.dim(0)); return NULL; } diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index 3ca0240c2826..7d7d381611ce 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -273,7 +273,7 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) } else { PyErr_Format( PyExc_ValueError, - "If 3-dimensional, array must be RGBA. Got %" NPY_INTP_FMT " planes.", + "If 3-dimensional, array must be RGBA. Got %ld planes.", PyArray_DIM(input_array, 2)); goto error; } diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index 80ec7f094e85..87343a0514a4 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -214,7 +214,7 @@ static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject if (minpos.dim(0) != 2) { PyErr_Format(PyExc_ValueError, - "minpos must be of length 2, got %"NPY_INTP_FMT, + "minpos must be of length 2, got %ld", minpos.dim(0)); return NULL; } diff --git a/src/py_converters.cpp b/src/py_converters.cpp index c93d67cdd581..8754332c0000 100644 --- a/src/py_converters.cpp +++ b/src/py_converters.cpp @@ -535,7 +535,7 @@ int convert_points(PyObject *obj, void *pointsp) if (points->dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "Points must be Nx2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "Points must be Nx2 array, got %ldx%ld", points->dim(0), points->dim(1)); return 0; } @@ -559,7 +559,7 @@ int convert_transforms(PyObject *obj, void *transp) if (trans->dim(1) != 3 || trans->dim(2) != 3) { PyErr_Format(PyExc_ValueError, - "Transforms must be Nx3x3 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "Transforms must be Nx3x3 array, got %ldx%ldx%ld", trans->dim(0), trans->dim(1), trans->dim(2)); return 0; } @@ -583,7 +583,7 @@ int convert_bboxes(PyObject *obj, void *bboxp) if (bbox->dim(1) != 2 || bbox->dim(2) != 2) { PyErr_Format(PyExc_ValueError, - "Bbox array must be Nx2x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "Bbox array must be Nx2x2 array, got %ldx%ldx%ld", bbox->dim(0), bbox->dim(1), bbox->dim(2)); return 0; } @@ -607,7 +607,7 @@ int convert_colors(PyObject *obj, void *colorsp) if (colors->dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "Colors array must be Nx4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT, + "Colors array must be Nx4 array, got %ldx%ld", colors->dim(0), colors->dim(1)); return 0; } From dca5e99807c63039b4e1878e4d742f6446109757 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Sat, 19 Mar 2016 14:08:11 +0000 Subject: [PATCH 3/3] Revert "Fix clang formatter warnings. These are long ints so format as such" This reverts commit eab5a9a990d53a2b4bc1bc2c9526381e9f58e6c8. --- src/_backend_agg_wrapper.cpp | 10 +++++----- src/_image_wrapper.cpp | 2 +- src/_path_wrapper.cpp | 2 +- src/py_converters.cpp | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/_backend_agg_wrapper.cpp b/src/_backend_agg_wrapper.cpp index b9383245bfec..d1003194cbef 100644 --- a/src/_backend_agg_wrapper.cpp +++ b/src/_backend_agg_wrapper.cpp @@ -449,14 +449,14 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec if (points.dim(0) != 3 || points.dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "points must be a 3x2 array, got %ldx%ld", + "points must be a 3x2 array, got %dx%d", points.dim(0), points.dim(1)); return NULL; } if (colors.dim(0) != 3 || colors.dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "colors must be a 3x4 array, got %ldx%ld", + "colors must be a 3x4 array, got %dx%d", colors.dim(0), colors.dim(1)); return NULL; } @@ -490,21 +490,21 @@ PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObje if (points.size() != 0 && (points.dim(1) != 3 || points.dim(2) != 2)) { PyErr_Format(PyExc_ValueError, - "points must be a Nx3x2 array, got %ldx%ldx%ld", + "points must be a Nx3x2 array, got %dx%dx%d", points.dim(0), points.dim(1), points.dim(2)); return NULL; } if (colors.size() != 0 && (colors.dim(1) != 3 || colors.dim(2) != 4)) { PyErr_Format(PyExc_ValueError, - "colors must be a Nx3x4 array, got %ldx%ldx%ld", + "colors must be a Nx3x4 array, got %dx%dx%d", colors.dim(0), colors.dim(1), colors.dim(2)); return NULL; } if (points.size() != colors.size()) { PyErr_Format(PyExc_ValueError, - "points and colors arrays must be the same length, got %ld and %ld", + "points and colors arrays must be the same length, got %d and %d", points.dim(0), colors.dim(0)); return NULL; } diff --git a/src/_image_wrapper.cpp b/src/_image_wrapper.cpp index 7d7d381611ce..aac86bf93673 100644 --- a/src/_image_wrapper.cpp +++ b/src/_image_wrapper.cpp @@ -273,7 +273,7 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs) } else { PyErr_Format( PyExc_ValueError, - "If 3-dimensional, array must be RGBA. Got %ld planes.", + "If 3-dimensional, array must be RGBA. Got %d planes.", PyArray_DIM(input_array, 2)); goto error; } diff --git a/src/_path_wrapper.cpp b/src/_path_wrapper.cpp index 87343a0514a4..4a4fc2db1eb3 100644 --- a/src/_path_wrapper.cpp +++ b/src/_path_wrapper.cpp @@ -214,7 +214,7 @@ static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject if (minpos.dim(0) != 2) { PyErr_Format(PyExc_ValueError, - "minpos must be of length 2, got %ld", + "minpos must be of length 2, got %d", minpos.dim(0)); return NULL; } diff --git a/src/py_converters.cpp b/src/py_converters.cpp index 8754332c0000..631763bbc37a 100644 --- a/src/py_converters.cpp +++ b/src/py_converters.cpp @@ -535,7 +535,7 @@ int convert_points(PyObject *obj, void *pointsp) if (points->dim(1) != 2) { PyErr_Format(PyExc_ValueError, - "Points must be Nx2 array, got %ldx%ld", + "Points must be Nx2 array, got %dx%d", points->dim(0), points->dim(1)); return 0; } @@ -559,7 +559,7 @@ int convert_transforms(PyObject *obj, void *transp) if (trans->dim(1) != 3 || trans->dim(2) != 3) { PyErr_Format(PyExc_ValueError, - "Transforms must be Nx3x3 array, got %ldx%ldx%ld", + "Transforms must be Nx3x3 array, got %dx%dx%d", trans->dim(0), trans->dim(1), trans->dim(2)); return 0; } @@ -583,7 +583,7 @@ int convert_bboxes(PyObject *obj, void *bboxp) if (bbox->dim(1) != 2 || bbox->dim(2) != 2) { PyErr_Format(PyExc_ValueError, - "Bbox array must be Nx2x2 array, got %ldx%ldx%ld", + "Bbox array must be Nx2x2 array, got %dx%dx%d", bbox->dim(0), bbox->dim(1), bbox->dim(2)); return 0; } @@ -607,7 +607,7 @@ int convert_colors(PyObject *obj, void *colorsp) if (colors->dim(1) != 4) { PyErr_Format(PyExc_ValueError, - "Colors array must be Nx4 array, got %ldx%ld", + "Colors array must be Nx4 array, got %dx%d", colors->dim(0), colors->dim(1)); return 0; }