diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/include/numpy/npy_common.h | 10 | ||||
-rw-r--r-- | numpy/core/setup.py | 5 | ||||
-rw-r--r-- | numpy/core/setup_common.py | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index 46c745c99..44d7e1010 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -25,6 +25,16 @@ #define NPY_GCC_OPT_3 #endif +/* + * mark an argument (starting from 1) that must not be NULL and is not checked + * DO NOT USE IF FUNCTION CHECKS FOR NULL!! the compiler will remove the check + */ +#ifdef HAVE_ATTRIBUTE_NONNULL +#define NPY_GCC_NONNULL(n) __attribute__((nonnull(n))) +#else +#define NPY_GCC_NONNULL(n) +#endif + #if defined HAVE_XMMINTRIN_H && defined HAVE__MM_LOAD_PS #define NPY_HAVE_SSE_INTRINSICS #endif diff --git a/numpy/core/setup.py b/numpy/core/setup.py index d48368ca1..c28de7c11 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -176,9 +176,8 @@ def check_math_capabilities(config, moredefs, mathlibs): moredefs.append((fname2def(f), 1)) for dec, fn in OPTIONAL_GCC_ATTRIBUTES: - if config.check_funcs_once([fn], - decl=dict((('%s %s' % (dec, fn), True),)), - call=False): + if config.check_func(fn, decl='int %s %s(void *);' % (dec, fn), + call=False): moredefs.append((fname2def(fn), 1)) # C99 functions: float and long double versions diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index af2590fc7..4188f4c3f 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -127,6 +127,8 @@ OPTIONAL_GCC_ATTRIBUTES = [('__attribute__((optimize("unroll-loops")))', 'attribute_optimize_unroll_loops'), ('__attribute__((optimize("O3")))', 'attribute_optimize_opt_3'), + ('__attribute__((nonnull (1)))', + 'attribute_nonnull'), ] # Subset of OPTIONAL_STDFUNCS which may alreay have HAVE_* defined by Python.h |