8000 Merge pull request #7514 from QuLogic/ext-warnings · matplotlib/matplotlib@3972533 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3972533

Browse files
authored
Merge pull request #7514 from QuLogic/ext-warnings
BLD: Fix some minor warnings in extensions
2 parents 5ed5f2e + 1ccdfc1 commit 3972533

File tree

8 files changed

+29
-26
lines changed

8 files changed

+29
-26
lines changed

extern/agg24-svn/include/agg_span_gouraud_rgba.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ namespace agg
198198
vg = g.y();
199199
vb = b.y();
200200
va = a.y();
201-
if(vr < 0) vr = 0; if(vr > lim) vr = lim;
202-
if(vg < 0) vg = 0; if(vg > lim) vg = lim;
203-
if(vb < 0) vb = 0; if(vb > lim) vb = lim;
204-
if(va < 0) va = 0; if(va > lim) va = lim;
201+
if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; };
202+
if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; };
203+
if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; };
204+
if(va < 0) { va = 0; }; if(va > lim) { va = lim; };
205205
span->r = (value_type)vr;
206206
span->g = (value_type)vg;
207207
span->b = (value_type)vb;
@@ -245,10 +245,10 @@ namespace agg
245245
vg = g.y();
246246
vb = b.y();
247247
va = a.y();
248-
if(vr < 0) vr = 0; if(vr > lim) vr = lim;
249-
if(vg < 0) vg = 0; if(vg > lim) vg = lim;
250-
if(vb < 0) vb = 0; if(vb > lim) vb = lim;
251-
if(va < 0) va = 0; if(va > lim) va = lim;
248+
if(vr < 0) { vr = 0; }; if(vr > lim) { vr = lim; };
249+
if(vg < 0) { vg = 0; }; if(vg > lim) { vg = lim; };
250+
if(vb < 0) { vb = 0; }; if(vb > lim) { vb = lim; };
251+
if(va < 0) { va = 0; }; if(va > lim) { va = lim; };
252252
span->r = (value_type)vr;
253253
span->g = (value_type)vg;
254254
span->b = (value_type)vb;

setupext.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from distutils import sysconfig
44
from distutils import version
55
from distutils.core import Extension
6+
import distutils.command.build_ext
67
import glob
78
import multiprocessing
89
import os
@@ -228,8 +229,8 @@ def print_line(*args, **kwargs):
228229
print_status = print_message = print_raw = print_line
229230

230231

231-
# Remove the -Wstrict-prototypesoption, is it's not valid for C++
232-
customize_compiler = sysconfig.customize_compiler
232+
# Remove the -Wstrict-prototypes option, is it's not valid for C++
233+
customize_compiler = distutils.command.build_ext.customize_compiler
233234

234235

235236
def my_customize_compiler(compiler):
@@ -240,7 +241,7 @@ def my_customize_compiler(compiler):
240241
pass
241242
return retval
242243

243-
sysconfig.customize_compiler = my_customize_compiler
244+
distutils.command.build_ext.customize_compiler = my_customize_compiler
244245

245246

246247
def make_extension(name, files, *args, **kwargs):
@@ -897,6 +898,9 @@ def add_flags(self, ext):
897898
ext.define_macros.append(('NPY_NO_DEPRECATED_API',
898899
'NPY_1_7_API_VERSION'))
899900

901+
# Allow NumPy's printf format specifiers in C++.
902+
ext.define_macros.append(('__STDC_FORMAT_MACROS', 1))
903+
900904
def get_setup_requires(self):
901905
return ['numpy>=1.7.1']
902906

src/_backend_agg_wrapper.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,14 @@ PyRendererAgg_draw_gouraud_triangle(PyRendererAgg *self, PyObject *args, PyObjec
459459

460460
if (points.dim(0) != 3 || points.dim(1) != 2) {
461461
PyErr_Format(PyExc_ValueError,
462-
"points must be a 3x2 array, got %dx%d",
462+
"points must be a 3x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT,
463463
points.dim(0), points.dim(1));
464464
return NULL;
465465
}
466466

467467
if (colors.dim(0) != 3 || colors.dim(1) != 4) {
468468
PyErr_Format(PyExc_ValueError,
469-
"colors must be a 3x4 array, got %dx%d",
469+
"colors must be a 3x4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT,
470470
colors.dim(0), colors.dim(1));
471471
return NULL;
472472
}
@@ -500,21 +500,21 @@ PyRendererAgg_draw_gouraud_triangles(PyRendererAgg *self, PyObject *args, PyObje
500500

501501
if (points.size() != 0 && (points.dim(1) != 3 || points.dim(2) != 2)) {
502502
PyErr_Format(PyExc_ValueError,
503-
"points must be a Nx3x2 array, got %dx%dx%d",
503+
"points must be a Nx3x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT,
504504
points.dim(0), points.dim(1), points.dim(2));
505505
return NULL;
506506
}
507507

508508
if (colors.size() != 0 && (colors.dim(1) != 3 || colors.dim(2) != 4)) {
509509
PyErr_Format(PyExc_ValueError,
510-
"colors must be a Nx3x4 array, got %dx%dx%d",
510+
"colors must be a Nx3x4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT,
511511
colors.dim(0), colors.dim(1), colors.dim(2));
512512
return NULL;
513513
}
514514

515515
if (points.size() != colors.size()) {
516516
PyErr_Format(PyExc_ValueError,
517-
"points and colors arrays must be the same length, got %d and %d",
517+
"points and colors arrays must be the same length, got %" NPY_INTP_FMT " and %" NPY_INTP_FMT,
518518
points.dim(0), colors.dim(0));
519519
return NULL;
520520
}

src/_gtkagg.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* -*- mode: c++; c-basic-offset: 4 -*- */
22

3-
#include <vector>
4-
53
#include <pygobject.h>
64
#include <pygtk/pygtk.h>
75

6+
#include <vector>
7+
88
#include "agg_basics.h"
99
#include "agg_pixfmt_rgba.h"
1010
#include "agg_renderer_base.h"

src/_image_wrapper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ image_resample(PyObject *self, PyObject* args, PyObject *kwargs)
273273
} else {
274274
PyErr_Format(
275275
PyExc_ValueError,
276-
"If 3-dimensional, array must be RGBA. Got %d planes.",
276+
"If 3-dimensional, array must be RGBA. Got %" NPY_INTP_FMT " planes.",
277277
PyArray_DIM(input_array, 2));
278278
goto error;
279279
}

src/_path_wrapper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
PyObject *convert_polygon_vector(std::vector<Polygon> &polygons)
99
{
1010
PyObject *pyresult = PyList_New(polygons.size());
11-
bool fix_endpoints;
1211

1312
for (size_t i = 0; i < polygons.size(); ++i) {
1413
Polygon poly = polygons[i];
@@ -202,7 +201,7 @@ static PyObject *Py_update_path_extents(PyObject *self, PyObject *args, PyObject
202201

203202
if (minpos.dim(0) != 2) {
204203
PyErr_Format(PyExc_ValueError,
205-
"minpos must be of length 2, got %d",
204+
"minpos must be of length 2, got %" NPY_INTP_FMT,
206205
minpos.dim(0));
207206
return NULL;
208207
}

src/py_converters.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ int convert_points(PyObject *obj, void *pointsp)
537537

538538
if (points->dim(1) != 2) {
539539
PyErr_Format(PyExc_ValueError,
540-
"Points must be Nx2 array, got %dx%d",
540+
"Points must be Nx2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT,
541541
points->dim(0), points->dim(1));
542542
return 0;
543543
}
@@ -561,7 +561,7 @@ int convert_transforms(PyObject *obj, void *transp)
561561

562562
if (trans->dim(1) != 3 || trans->dim(2) != 3) {
563563
PyErr_Format(PyExc_ValueError,
564-
"Transforms must be Nx3x3 array, got %dx%dx%d",
564+
"Transforms must be Nx3x3 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT,
565565
trans->dim(0), trans->dim(1), trans->dim(2));
566566
return 0;
567567
}
@@ -585,7 +585,7 @@ int convert_bboxes(PyObject *obj, void *bboxp)
585585

586586
if (bbox->dim(1) != 2 || bbox->dim(2) != 2) {
587587
PyErr_Format(PyExc_ValueError,
588-
"Bbox array must be Nx2x2 array, got %dx%dx%d",
588+
"Bbox array must be Nx2x2 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT "x%" NPY_INTP_FMT,
589589
bbox->dim(0), bbox->dim(1), bbox->dim(2));
590590
return 0;
591591
}
@@ -609,7 +609,7 @@ int convert_colors(PyObject *obj, void *colorsp)
609609

610610
if (colors->dim(1) != 4) {
611611
PyErr_Format(PyExc_ValueError,
612-
"Colors array must be Nx4 array, got %dx%d",
612+
"Colors array must be Nx4 array, got %" NPY_INTP_FMT "x%" NPY_INTP_FMT,
613613
colors->dim(0), colors->dim(1));
614614
return 0;
615615
}

src/qhull_wrap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ delaunay(PyObject *self, PyObject *args)
310310

311311
/* Return qhull version string for assistance in debugging. */
312312
static PyObject*
313-
version()
313+
version(void)
314314
{
315315
return PyBytes_FromString(qh_version);
316316
}

0 commit comments

Comments
 (0)
0