8000 Cleanup clang warnings by jenshnielsen · Pull Request #6052 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Cleanup clang warnings #6052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,11 @@ 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']

Expand Down
10 changes: 5 additions & 5 deletions src/_backend_agg_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 %dx%d",
"points must be a 3x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT,
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 %dx%d",
"colors must be a 3x4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT,
colors.dim(0), colors.dim(1));
return NULL;
}
Expand Down Expand Up @@ -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 %dx%dx%d",
"points must be a Nx3x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT,
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 %dx%dx%d",
"colors must be a Nx3x4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT,
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 %d and %d",
"points and colors arrays must be the same length, got %"NPY_INTP_FMT" and %"NPY_INTP_FMT,
points.dim(0), colors.dim(0));
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/_image_resample.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,8 +908,8 @@ void resample(

if (params.interpolation != NEAREST &&
params.is_affine &&
abs(params.affine.sx) == 1.0 &&
abs(params.affine.sy) == 1.0 &&
fabs(params.affine.sx) == 1.0 &&
fabs(params.affine.sy) == 1.0 &&
params.affine.shx == 0.0 &&
params.affine.shy == 0.0) {
params.interpolation = NEAREST;
Expand Down
2 changes: 1 addition & 1 deletion src/_image_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 %d planes.",
"If 3-dimensional, array must be RGBA. Got %" NPY_INTP_FMT " planes.",
PyArray_DIM(input_array, 2));
goto error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/_path_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 %d",
"minpos must be of length 2, got %"NPY_INTP_FMT,
minpos.dim(0));
return NULL;
}
Expand Down
8 changes: 4 additions & 4 deletions src/py_converters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 %dx%d",
"Points must be Nx2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT,
points->dim(0), points->dim(1));
return 0;
}
Expand All @@ -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 %dx%dx%d",
"Transforms must be Nx3x3 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT,
trans->dim(0), trans->dim(1), trans->dim(2));
return 0;
}
Expand All @@ -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 %dx%dx%d",
"Bbox array must be Nx2x2 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT"x%"NPY_INTP_FMT,
bbox->dim(0), bbox->dim(1), bbox->dim(2));
return 0;
}
Expand All @@ -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 %dx%d",
"Colors array must be Nx4 array, got %"NPY_INTP_FMT"x%"NPY_INTP_FMT,
colors->dim(0), colors->dim(1));
return 0;
}
Expand Down
0