diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2020-10-21 15:38:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 15:38:17 -0500 |
commit | 04934769d5d667404dd311256632618a13625e91 (patch) | |
tree | 08e7996a0eec2b8443616525c715f68fd228151c | |
parent | ac26202be0fee25871845e2fb479bf0b09be2b3e (diff) | |
parent | 250ab1270ad54f133816956bc64de39b7533968c (diff) | |
download | numpy-04934769d5d667404dd311256632618a13625e91.tar.gz |
Merge pull request #17603 from charris/cleanup-clang-warnings
MAINT: Mark dead code as intentional for clang.
-rw-r--r-- | numpy/core/src/multiarray/array_coercion.c | 2 | ||||
-rw-r--r-- | numpy/core/src/npysort/selection.c.src | 3 | ||||
-rw-r--r-- | numpy/core/src/umath/loops.c.src | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c index 4831dfca6..ffb9bdbe8 100644 --- a/numpy/core/src/multiarray/array_coercion.c +++ b/numpy/core/src/multiarray/array_coercion.c @@ -298,7 +298,7 @@ discover_dtype_from_pyobject( Py_INCREF(DType); Py_DECREF(legacy_descr); /* TODO: Enable warning about subclass handling */ - if (0 && !((*flags) & GAVE_SUBCLASS_WARNING)) { + if ((0) && !((*flags) & GAVE_SUBCLASS_WARNING)) { if (DEPRECATE_FUTUREWARNING( "in the future NumPy will not automatically find the " "dtype for subclasses of scalars known to NumPy (i.e. " diff --git a/numpy/core/src/npysort/selection.c.src b/numpy/core/src/npysort/selection.c.src index 4fd955200..0e285b320 100644 --- a/numpy/core/src/npysort/selection.c.src +++ b/numpy/core/src/npysort/selection.c.src @@ -323,7 +323,8 @@ NPY_NO_EXPORT int store_pivot(kth, kth, pivots, npiv); return 0; } - else if (@inexact@ && kth == num - 1) { + // Parenthesis around @inexact@ tells clang dead code as intentional + else if ((@inexact@) && kth == num - 1) { /* useful to check if NaN present via partition(d, (x, -1)) */ npy_intp k; npy_intp maxidx = low; diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src index d9591ab33..ef3d5a21a 100644 --- a/numpy/core/src/umath/loops.c.src +++ b/numpy/core/src/umath/loops.c.src @@ -2647,7 +2647,8 @@ pairwise_sum_@TYPE@(@ftype@ *rr, @ftype@ * ri, char * a, npy_intp n, NPY_NO_EXPORT void @TYPE@_@kind@(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func)) { - if (IS_BINARY_REDUCE && @PW@) { + // Parenthesis around @PW@ tells clang dead code is intentional + if (IS_BINARY_REDUCE && (@PW@)) { npy_intp n = dimensions[0]; @ftype@ * or = ((@ftype@ *)args[0]); @ftype@ * oi = ((@ftype@ *)args[0]) + 1; |