Skip to content

Commit

Permalink
Merge pull request #19824 from charris/cleanup-includes
Browse files Browse the repository at this point in the history
MAINT: Small cleanups of includes in *.c files.
  • Loading branch information
charris committed Sep 4, 2021
2 parents 410a89e + 7653829 commit 3544fae
Show file tree
Hide file tree
Showing 65 changed files with 204 additions and 198 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DerivePointerAlignment: false
IndentWidth: 4
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](Python|structmember)'
- Regex: '^[<"](Python|structmember|pymem)'
Priority: -3
CaseSensitive: true
- Regex: '^"numpy/'
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/common/array_assign.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
*
* See LICENSE.txt for the license.
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/ndarraytypes.h>
#include "npy_config.h"
#include "npy_pycompat.h"
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/common/cblasfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* This module provides a BLAS optimized matrix multiply,
* inner product and dot for numpy arrays
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "npy_cblas.h"
#include "arraytypes.h"
Expand Down
3 changes: 2 additions & 1 deletion numpy/core/src/common/mem_overlap.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@
All rights reserved.
Licensed under 3-clause BSD license, see LICENSE.txt.
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#include "numpy/ndarraytypes.h"
#include "mem_overlap.h"
#include "npy_extint128.h"
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/common/npy_argparse.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "numpy/ndarraytypes.h"
#include "npy_argparse.h"
#include "npy_pycompat.h"
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/common/npy_longdouble.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "numpy/ndarraytypes.h"
#include "numpy/npy_math.h"
#include "npy_pycompat.h"
Expand Down
17 changes: 7 additions & 10 deletions numpy/core/src/common/numpyos.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include <locale.h>
#include <stdio.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/npy_math.h"

#include "npy_config.h"

#include "npy_pycompat.h"

#include <locale.h>
#include <stdio.h>

#ifdef HAVE_STRTOLD_L
#include <stdlib.h>
#ifdef HAVE_XLOCALE_H
/*
* the defines from xlocale.h are included in locale.h on some systems;
* see gh-8367
*/
#include <xlocale.h>
#include <xlocale.h> // xlocale was removed in glibc 2.26, see gh-8367
#endif
#endif

Expand Down
5 changes: 1 addition & 4 deletions numpy/core/src/common/ucsnarrow.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include <locale.h>
#include <stdio.h>

#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/npy_math.h"

Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/dummymodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* This is a dummy module whose purpose is to get distutils to generate the
* configuration files before the libraries are made.
*/
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define NO_IMPORT_ARRAY

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "npy_pycompat.h"

static struct PyMethodDef methods[] = {
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/abstractdtypes.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>


#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/ndarraytypes.h"
#include "numpy/arrayobject.h"

Expand Down
12 changes: 5 additions & 7 deletions numpy/core/src/multiarray/alloc.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#include <pymem.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/ndarraytypes.h>
#include "numpy/ndarraytypes.h"
#include "numpy/arrayobject.h"
#include <numpy/npy_common.h>
#include "numpy/npy_common.h"
#include "npy_config.h"
#include "alloc.h"


#include <assert.h>

#ifdef NPY_OS_LINUX
#include <sys/mman.h>
#ifndef MADV_HUGEPAGE
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/array_assign_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
*
* See LICENSE.txt for the license.
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/ndarraytypes.h>
#include "numpy/ndarraytypes.h"

#include "npy_config.h"
#include "npy_pycompat.h"
Expand Down
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/array_assign_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*
* See LICENSE.txt for the license.
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/ndarraytypes.h>

#include "npy_config.h"
Expand Down
8 changes: 4 additions & 4 deletions numpy/core/src/multiarray/array_coercion.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _UMATHMODULE
#define _MULTIARRAYMODULE
#define _UMATHMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#include "numpy/npy_3kcompat.h"

Expand Down
3 changes: 1 addition & 2 deletions numpy/core/src/multiarray/array_method.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@
* It is then sufficient for a ufunc (or other owner) to only hold a
* weak reference to the input DTypes.
*/


#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#include <npy_pycompat.h>
#include "arrayobject.h"
#include "array_method.h"
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/arrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ maintainer email: oliphant.travis@ieee.org
Space Science Telescope Institute
(J. Todd Miller, Perry Greenfield, Rick White)
*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

/*#include <stdio.h>*/
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/buffer.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/calculation.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "lowlevel_strided_loops.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/common.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"

#include "npy_config.h"
Expand Down
7 changes: 4 additions & 3 deletions numpy/core/src/multiarray/common_dtype.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include <numpy/npy_common.h>
#include "numpy/npy_common.h"
#include "numpy/arrayobject.h"

#include "common_dtype.h"
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/compiled_base.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION

#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/npy_3kcompat.h"
#include "numpy/npy_math.h"
Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/conversion_utils.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/convert.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#include "npy_config.h"

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_pycompat.h"
Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/convert_datatype.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

Expand Down
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/ctors.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE

#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <structmember.h>

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"

Expand Down

0 comments on commit 3544fae

Please sign in to comment.