Skip to content

Commit 2afa142

Browse files
authored
Merge pull request numpy#9636 from juliantaylor/warning-fix
MAINT: Fix compiler warnings and update travis jobs
2 parents 447e7e4 + 7697bf0 commit 2afa142

File tree

6 files changed

+38
-47
lines changed

6 files changed

+38
-47
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ python:
3838
matrix:
3939
include:
4040
- python: 2.7
41-
env: PY3_COMPATIBILITY_CHECK=1
42-
- python: 2.7
43-
env: USE_CHROOT=1 ARCH=i386 DIST=yakkety PYTHON=2.7
41+
env: USE_CHROOT=1 ARCH=i386 DIST=zesty PYTHON=2.7
4442
sudo: true
4543
dist: trusty
4644
addons:
@@ -69,7 +67,7 @@ matrix:
6967
- PYTHONOPTIMIZE=2
7068
- USE_ASV=1
7169
- python: 2.7
72-
env: NPY_RELAXED_STRIDES_CHECKING=0 PYTHON_OO=1
70+
env: NPY_RELAXED_STRIDES_CHECKING=0 PYTHON_OPTS="-3 -OO"
7371
- python: 2.7
7472
env: USE_WHEEL=1 NPY_RELAXED_STRIDES_DEBUG=1
7573
- python: 2.7

numpy/core/src/private/mem_overlap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,17 @@
181181
All rights reserved.
182182
Licensed under 3-clause BSD license, see LICENSE.txt.
183183
*/
184-
#include <stdlib.h>
185-
#include <stdio.h>
186-
#include <assert.h>
187184
#include <Python.h>
188185

189186
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
190187
#include "numpy/ndarraytypes.h"
191188
#include "mem_overlap.h"
192189
#include "npy_extint128.h"
193190

191+
#include <stdlib.h>
192+
#include <stdio.h>
193+
#include <assert.h>
194+
194195

195196
#define MAX(a, b) (((a) >= (b)) ? (a) : (b))
196197
#define MIN(a, b) (((a) <= (b)) ? (a) : (b))

numpy/core/src/umath/reduction.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "npy_config.h"
2222
#include "npy_pycompat.h"
2323

24+
#include "numpy/ufuncobject.h"
2425
#include "lowlevel_strided_loops.h"
2526
#include "reduction.h"
2627
#include "extobj.h" /* for _check_ufunc_fperr */

numpy/random/mtrand/distributions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
* SOFTWARE OR ITS DOCUMENTATION.
4242
*/
4343

44-
#include <math.h>
45-
#include <stdlib.h>
4644
#include "distributions.h"
4745
#include <stdio.h>
46+
#include <math.h>
47+
#include <stdlib.h>
4848

4949
#ifndef min
5050
#define min(x,y) ((x<y)?x:y)

numpy/random/mtrand/randomkit.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@
6464

6565
/* static char const rcsid[] =
6666
"@(#) $Jeannot: randomkit.c,v 1.28 2005/07/21 22:14:09 js Exp $"; */
67-
#include <stddef.h>
68-
#include <stdio.h>
69-
#include <stdlib.h>
70-
#include <errno.h>
71-
#include <limits.h>
72-
#include <math.h>
73-
#include <assert.h>
7467

7568
#ifdef _WIN32
7669
/*
@@ -109,18 +102,27 @@
109102
#include <wincrypt.h>
110103
#endif
111104

105+
/*
106+
* Do not move this include. randomkit.h must be included
107+
* after windows timeb.h is included.
108+
*/
109+
#include "randomkit.h"
110+
112111
#else
113112
/* Unix */
113+
#include "randomkit.h"
114114
#include <time.h>
115115
#include <sys/time.h>
116116
#include <unistd.h>
117117
#endif
118118

119-
/*
120-
* Do not move this include. randomkit.h must be included
121-
* after windows timeb.h is included.
122-
*/
123-
#include "randomkit.h"
119+
#include <stddef.h>
120+
#include <stdio.h>
121+
#include <stdlib.h>
122+
#include <errno.h>
123+
#include <limits.h>
124+
#include <math.h>
125+
#include <assert.h>
124126

125127
#ifndef RK_DEV_URANDOM
126128
#define RK_DEV_URANDOM "/dev/urandom"

tools/travis-test.sh

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ source builds/venv/bin/activate
2020
PYTHON=${PYTHON:-python}
2121
PIP=${PIP:-pip}
2222

23-
if [ -n "$PYTHON_OO" ]; then
24-
PYTHON="${PYTHON} -OO"
25-
fi
26-
27-
28-
if [ -n "$PY3_COMPATIBILITY_CHECK" ]; then
29-
PYTHON="${PYTHON} -3"
23+
if [ -n "$PYTHON_OPTS" ]; then
24+
PYTHON="${PYTHON} $PYTHON_OPTS"
3025
fi
3126

3227
# make some warnings fatal, mostly to match windows compilers
@@ -35,6 +30,10 @@ werrors+="-Werror=nonnull -Werror=pointer-arith"
3530

3631
setup_base()
3732
{
33+
# use default python flags but remoge sign-compare
34+
sysflags="$($PYTHON -c "from distutils import sysconfig; \
35+
print (sysconfig.get_config_var('CFLAGS'))")"
36+
export CFLAGS="$sysflags $werrors -Wlogical-op -Wno-sign-compare"
3837
# We used to use 'setup.py install' here, but that has the terrible
3938
# behaviour that if a copy of the package is already installed in the
4039
# install location, then the new copy just gets dropped on top of it.
@@ -45,26 +44,16 @@ setup_base()
4544
# the advantage that it tests that numpy is 'pip install' compatible,
4645
# see e.g. gh-2766...
4746
if [ -z "$USE_DEBUG" ]; then
48-
if [ -z "$IN_CHROOT" ]; then
49-
$PIP install .
50-
else
51-
sysflags="$($PYTHON -c "from distutils import sysconfig; \
52-
print (sysconfig.get_config_var('CFLAGS'))")"
53-
CFLAGS="$sysflags $werrors -Wlogical-op" $PIP install -v . 2>&1 | tee log
54-
grep -v "_configtest" log \
55-
| grep -vE "ld returned 1|no previously-included files matching|manifest_maker: standard file '-c'" \
56-
| grep -E "warning\>" \
57-
| tee warnings
58-
# Check for an acceptable number of warnings. Some warnings are out of
59-
# our control, so adjust the number as needed. At the moment a
60-
# cython generated code produces a warning about '-2147483648L', but
61-
# the code seems to compile OK.
62-
[[ $(wc -l < warnings) -lt 2 ]]
63-
fi
47+
$PIP install -v . 2>&1 | tee log
6448
else
65-
sysflags="$($PYTHON -c "from distutils import sysconfig; \
66-
print (sysconfig.get_config_var('CFLAGS'))")"
67-
CFLAGS="$sysflags $werrors" $PYTHON setup.py build_ext --inplace
49+
$PYTHON setup.py build_ext --inplace 2>&1 | tee log
50+
fi
51+
grep -v "_configtest" log \
52+
| grep -vE "ld returned 1|no previously-included files matching|manifest_maker: standard file '-c'" \
53+
| grep -E "warning\>" \
54+
| tee warnings
55+
if [ "$LAPACK" != "None" ]; then
56+
[[ $(wc -l < warnings) -lt 1 ]]
6857
fi
6958
}
7059

0 commit comments

Comments
 (0)