Skip to content

Commit

Permalink
MAINT: Standardize guards in numpy/core/src/multiarray.
Browse files Browse the repository at this point in the history
  • Loading branch information
charris committed Sep 5, 2021
1 parent 4af05ea commit 06cdc97
Show file tree
Hide file tree
Showing 47 changed files with 156 additions and 154 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|pymem)'
- Regex: '^[<"](Python|structmember|pymem)\.h'
Priority: -3
CaseSensitive: true
- Regex: '^"numpy/'
Expand Down
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/_datetime.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_PRIVATE__DATETIME_H_
#define _NPY_PRIVATE__DATETIME_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY__DATETIME_H_
#define NUMPY_CORE_SRC_MULTIARRAY__DATETIME_H_

extern NPY_NO_EXPORT char const *_datetime_strings[NPY_DATETIME_NUMUNITS];
extern NPY_NO_EXPORT int _days_per_month_table[2][12];
Expand Down Expand Up @@ -376,4 +376,4 @@ find_object_datetime_type(PyObject *obj, int type_num);
NPY_NO_EXPORT int
PyArray_InitializeDatetimeCasts(void);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY__DATETIME_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/abstractdtypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ABSTRACTDTYPES_H
#define _NPY_ABSTRACTDTYPES_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ABSTRACTDTYPES_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ABSTRACTDTYPES_H_

#include "dtypemeta.h"

Expand All @@ -16,4 +16,4 @@ NPY_NO_EXPORT extern PyArray_DTypeMeta PyArray_PyComplexAbstractDType;
NPY_NO_EXPORT int
initialize_and_map_pytypes_to_dtypes(void);

#endif /*_NPY_ABSTRACTDTYPES_H */
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ABSTRACTDTYPES_H_ */
9 changes: 5 additions & 4 deletions numpy/core/src/multiarray/alloc.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef _NPY_ARRAY_ALLOC_H_
#define _NPY_ARRAY_ALLOC_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ALLOC_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ALLOC_H_

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

#define NPY_TRACE_DOMAIN 389047

Expand Down Expand Up @@ -36,4 +37,4 @@ npy_free_cache_dim_array(PyArrayObject * arr)
npy_free_cache_dim(PyArray_DIMS(arr), PyArray_NDIM(arr));
}

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ALLOC_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/array_coercion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAY_COERCION_H
#define _NPY_ARRAY_COERCION_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ARRAY_COERCION_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ARRAY_COERCION_H_


/*
Expand Down Expand Up @@ -54,4 +54,4 @@ npy_unlink_coercion_cache(coercion_cache_obj *current);
NPY_NO_EXPORT int
PyArray_AssignFromCache(PyArrayObject *self, coercion_cache_obj *cache);

#endif /* _NPY_ARRAY_COERCION_H */
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAY_COERCION_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/array_method.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAY_METHOD_H
#define _NPY_ARRAY_METHOD_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ARRAY_METHOD_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ARRAY_METHOD_H_

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
Expand Down Expand Up @@ -177,4 +177,4 @@ PyArrayMethod_GetMaskedStridedLoop(
NPY_NO_EXPORT PyBoundArrayMethodObject *
PyArrayMethod_FromSpec_int(PyArrayMethod_Spec *spec, int private);

#endif /*_NPY_ARRAY_METHOD_H*/
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAY_METHOD_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/arrayfunction_override.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_PRIVATE__ARRAYFUNCTION_OVERRIDE_H
#define _NPY_PRIVATE__ARRAYFUNCTION_OVERRIDE_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ARRAYFUNCTION_OVERRIDE_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ARRAYFUNCTION_OVERRIDE_H_

NPY_NO_EXPORT PyObject *
array_implement_array_function(
Expand All @@ -19,4 +19,4 @@ NPY_NO_EXPORT PyObject *
array_function_method_impl(PyObject *func, PyObject *types, PyObject *args,
PyObject *kwargs);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAYFUNCTION_OVERRIDE_H_ */
8 changes: 4 additions & 4 deletions numpy/core/src/multiarray/arrayobject.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef _NPY_INTERNAL_ARRAYOBJECT_H_
#define _NPY_INTERNAL_ARRAYOBJECT_H_

#ifndef _MULTIARRAYMODULE
#error You should not include this
#endif

#ifndef NUMPY_CORE_SRC_MULTIARRAY_ARRAYOBJECT_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ARRAYOBJECT_H_

NPY_NO_EXPORT PyObject *
_strings_richcompare(PyArrayObject *self, PyArrayObject *other, int cmp_op,
int rstrip);
Expand All @@ -26,4 +26,4 @@ array_might_be_written(PyArrayObject *obj);
*/
static const int NPY_ARRAY_WARN_ON_WRITE = (1 << 31);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAYOBJECT_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/arraytypes.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAYTYPES_H_
#define _NPY_ARRAYTYPES_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_ARRAYTYPES_H_
#define NUMPY_CORE_SRC_MULTIARRAY_ARRAYTYPES_H_

#include "common.h"

Expand Down Expand Up @@ -28,4 +28,4 @@ small_correlate(const char * d_, npy_intp dstride,
npy_intp nk, enum NPY_TYPES ktype,
char * out_, npy_intp ostride);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_ARRAYTYPES_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/calculation.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_CALCULATION_H_
#define _NPY_CALCULATION_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_CALCULATION_H_
#define NUMPY_CORE_SRC_MULTIARRAY_CALCULATION_H_

NPY_NO_EXPORT PyObject*
PyArray_ArgMax(PyArrayObject* self, int axis, PyArrayObject *out);
Expand Down Expand Up @@ -67,4 +67,4 @@ PyArray_All(PyArrayObject* self, int axis, PyArrayObject* out);
NPY_NO_EXPORT PyObject*
PyArray_Any(PyArrayObject* self, int axis, PyArrayObject* out);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_CALCULATION_H_ */
14 changes: 7 additions & 7 deletions numpy/core/src/multiarray/common.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef _NPY_PRIVATE_COMMON_H_
#define _NPY_PRIVATE_COMMON_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_COMMON_H_
#define NUMPY_CORE_SRC_MULTIARRAY_COMMON_H_

#include <structmember.h>
#include <numpy/npy_common.h>
#include <numpy/ndarraytypes.h>
#include <limits.h>
#include "numpy/npy_common.h"
#include "numpy/ndarraytypes.h"
#include "npy_import.h"
#include <limits.h>

#define error_converting(x) (((x) == -1) && PyErr_Occurred())

Expand Down Expand Up @@ -343,5 +344,4 @@ new_array_for_sum(PyArrayObject *ap1, PyArrayObject *ap2, PyArrayObject* out,
*/
#define NPY_ITER_REDUCTION_AXIS(axis) (axis + (1 << (NPY_BITSOF_INT - 2)))

#endif

#endif /* NUMPY_CORE_SRC_MULTIARRAY_COMMON_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/common_dtype.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_COMMON_DTYPE_H_
#define _NPY_COMMON_DTYPE_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_COMMON_DTYPE_H_
#define NUMPY_CORE_SRC_MULTIARRAY_COMMON_DTYPE_H_

#define NPY_NO_DEPRECATED_API NPY_API_VERSION
#define _MULTIARRAYMODULE
Expand All @@ -14,4 +14,4 @@ NPY_NO_EXPORT PyArray_DTypeMeta *
PyArray_PromoteDTypeSequence(
npy_intp length, PyArray_DTypeMeta **dtypes_in);

#endif /* _NPY_COMMON_DTYPE_H_ */
#endif /* NUMPY_CORE_SRC_MULTIARRAY_COMMON_DTYPE_H_ */
9 changes: 5 additions & 4 deletions numpy/core/src/multiarray/compiled_base.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _NPY_PRIVATE__COMPILED_BASE_H_
#define _NPY_PRIVATE__COMPILED_BASE_H_
#include <numpy/ndarraytypes.h>
#ifndef NUMPY_CORE_SRC_MULTIARRAY_COMPILED_BASE_H_
#define NUMPY_CORE_SRC_MULTIARRAY_COMPILED_BASE_H_

#include "numpy/ndarraytypes.h"

NPY_NO_EXPORT PyObject *
arr_insert(PyObject *, PyObject *, PyObject *);
Expand All @@ -23,4 +24,4 @@ io_pack(PyObject *, PyObject *, PyObject *);
NPY_NO_EXPORT PyObject *
io_unpack(PyObject *, PyObject *, PyObject *);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_COMPILED_BASE_H_ */
8 changes: 4 additions & 4 deletions numpy/core/src/multiarray/conversion_utils.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _NPY_PRIVATE_CONVERSION_UTILS_H_
#define _NPY_PRIVATE_CONVERSION_UTILS_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_CONVERSION_UTILS_H_
#define NUMPY_CORE_SRC_MULTIARRAY_CONVERSION_UTILS_H_

#include <numpy/ndarraytypes.h>
#include "numpy/ndarraytypes.h"

NPY_NO_EXPORT int
PyArray_IntpConverter(PyObject *obj, PyArray_Dims *seq);
Expand Down Expand Up @@ -82,4 +82,4 @@ PyArray_ConvertMultiAxis(PyObject *axis_in, int ndim, npy_bool *out_axis_flags);
*/
extern NPY_NO_EXPORT int evil_global_disable_warn_O4O8_flag;

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_CONVERSION_UTILS_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/convert.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _NPY_ARRAYOBJECT_CONVERT_H_
#define _NPY_ARRAYOBJECT_CONVERT_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_CONVERT_H_
#define NUMPY_CORE_SRC_MULTIARRAY_CONVERT_H_

NPY_NO_EXPORT int
PyArray_AssignZero(PyArrayObject *dst,
PyArrayObject *wheremask);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_CONVERT_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/convert_datatype.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAY_CONVERT_DATATYPE_H_
#define _NPY_ARRAY_CONVERT_DATATYPE_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_CONVERT_DATATYPE_H_
#define NUMPY_CORE_SRC_MULTIARRAY_CONVERT_DATATYPE_H_

#include "array_method.h"

Expand Down Expand Up @@ -99,4 +99,4 @@ simple_cast_resolve_descriptors(
NPY_NO_EXPORT int
PyArray_InitializeCasts(void);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_CONVERT_DATATYPE_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/ctors.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAY_CTORS_H_
#define _NPY_ARRAY_CTORS_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_CTORS_H_
#define NUMPY_CORE_SRC_MULTIARRAY_CTORS_H_

NPY_NO_EXPORT PyObject *
PyArray_NewFromDescr(
Expand Down Expand Up @@ -102,4 +102,4 @@ NPY_NO_EXPORT PyArrayObject *
PyArray_SubclassWrap(PyArrayObject *arr_of_subclass, PyArrayObject *towrap);


#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_CTORS_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/datetime_busday.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_PRIVATE__DATETIME_BUSDAY_H_
#define _NPY_PRIVATE__DATETIME_BUSDAY_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAY_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAY_H_

/*
* This is the 'busday_offset' function exposed for calling
Expand All @@ -25,4 +25,4 @@ NPY_NO_EXPORT PyObject *
array_is_busday(PyObject *NPY_UNUSED(self),
PyObject *args, PyObject *kwds);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAY_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/datetime_busdaycal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_PRIVATE__DATETIME_BUSDAYDEF_H_
#define _NPY_PRIVATE__DATETIME_BUSDAYDEF_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAYCAL_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAYCAL_H_

/*
* A list of holidays, which should be sorted, not contain any
Expand Down Expand Up @@ -59,4 +59,4 @@ PyArray_HolidaysConverter(PyObject *dates_in, npy_holidayslist *holidays);



#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DATETIME_BUSDAYCAL_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/datetime_strings.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_PRIVATE__DATETIME_STRINGS_H_
#define _NPY_PRIVATE__DATETIME_STRINGS_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DATETIME_STRINGS_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DATETIME_STRINGS_H_

/*
* Parses (almost) standard ISO 8601 date strings. The differences are:
Expand Down Expand Up @@ -81,4 +81,4 @@ NPY_NO_EXPORT PyObject *
array_datetime_as_string(PyObject *NPY_UNUSED(self), PyObject *args,
PyObject *kwds);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DATETIME_STRINGS_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/descriptor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_ARRAYDESCR_H_
#define _NPY_ARRAYDESCR_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DESCRIPTOR_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DESCRIPTOR_H_

NPY_NO_EXPORT PyObject *arraydescr_protocol_typestr_get(
PyArray_Descr *, void *);
Expand Down Expand Up @@ -30,4 +30,4 @@ arraydescr_field_subset_view(PyArray_Descr *self, PyObject *ind);

extern NPY_NO_EXPORT char const *_datetime_strings[];

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DESCRIPTOR_H_ */
8 changes: 3 additions & 5 deletions numpy/core/src/multiarray/dragon4.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
* Ryan Juckett's original code was under the Zlib license; he gave numpy
* permission to include it under the MIT license instead.
*/

#ifndef _NPY_DRAGON4_H_
#define _NPY_DRAGON4_H_
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DRAGON4_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DRAGON4_H_

#include <Python.h>
#include <structmember.h>
Expand Down Expand Up @@ -136,5 +135,4 @@ Dragon4_Scientific(PyObject *obj, DigitMode digit_mode, int precision,
int min_digits, int sign, TrimMode trim, int pad_left,
int exp_digits);

#endif

#endif /* NUMPY_CORE_SRC_MULTIARRAY_DRAGON4_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/dtype_transfer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_DTYPE_TRANSFER_H
#define _NPY_DTYPE_TRANSFER_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DTYPE_TRANSFER_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DTYPE_TRANSFER_H_

#include "array_method.h"

Expand Down Expand Up @@ -202,4 +202,4 @@ get_wrapped_legacy_cast_function(int aligned,
int *out_needs_api, int allow_wrapped);


#endif /* _NPY_DTYPE_TRANSFER_H */
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DTYPE_TRANSFER_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/dtypemeta.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_DTYPEMETA_H
#define _NPY_DTYPEMETA_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_DTYPEMETA_H_
#define NUMPY_CORE_SRC_MULTIARRAY_DTYPEMETA_H_


/* DType flags, currently private, since we may just expose functions */
Expand Down Expand Up @@ -80,4 +80,4 @@ PyArray_DTypeFromTypeNum(int typenum)
NPY_NO_EXPORT int
dtypemeta_wrap_legacy_descriptor(PyArray_Descr *dtypem);

#endif /*_NPY_DTYPEMETA_H */
#endif /* NUMPY_CORE_SRC_MULTIARRAY_DTYPEMETA_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/einsum_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*
* See LICENSE.txt for the license.
*/
#ifndef _NPY_MULTIARRAY_EINSUM_DEBUG_H
#define _NPY_MULTIARRAY_EINSUM_DEBUG_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_EINSUM_DEBUG_H_
#define NUMPY_CORE_SRC_MULTIARRAY_EINSUM_DEBUG_H_

/********** PRINTF DEBUG TRACING **************/
#define NPY_EINSUM_DBG_TRACING 0
Expand All @@ -25,4 +25,4 @@
#define NPY_EINSUM_DBG_PRINT3(s, p1, p2, p3)
#endif

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_EINSUM_DEBUG_H_ */
6 changes: 3 additions & 3 deletions numpy/core/src/multiarray/einsum_sumprod.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NPY_MULTIARRAY_EINSUM_SUMPROD_H
#define _NPY_MULTIARRAY_EINSUM_SUMPROD_H
#ifndef NUMPY_CORE_SRC_MULTIARRAY_EINSUM_SUMPROD_H_
#define NUMPY_CORE_SRC_MULTIARRAY_EINSUM_SUMPROD_H_

#include <numpy/npy_common.h>

Expand All @@ -9,4 +9,4 @@ NPY_VISIBILITY_HIDDEN sum_of_products_fn
get_sum_of_products_function(int nop, int type_num,
npy_intp itemsize, npy_intp const *fixed_strides);

#endif
#endif /* NUMPY_CORE_SRC_MULTIARRAY_EINSUM_SUMPROD_H_ */
Loading

0 comments on commit 06cdc97

Please sign in to comment.