Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace C macros beginning with _ and an uppercase #153

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Northwestern University and Argonne National Laboratory.
* [E3SM I/O kernel study](https://github.com/Parallel-NetCDF/E3SM-IO)
* [Scorpio](https://github.com/E3SM-Project/scorpio), the I/O module of E3SM.
* [PIO](https://github.com/NCAR/ParallelIO) - parallel I/O library at NCAR.
* [WRF](https://github.com/wrf-model/WRF/tree/master/external/io_pnetcdf)
- Weather Research & Forecasting Model at NCAR.
* [WRF](https://github.com/wrf-model/WRF/tree/master/external/io_pnetcdf) -
Weather Research & Forecasting Model at NCAR.


### Acknowledgements
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ AH_TEMPLATE([ENABLE_REQ_AGGREGATION], [Define if able to support request aggre
dnl AH_TEMPLATE([HAVE_MPI_COUNT], [Define if type MPI_Count is defined])
AH_TEMPLATE([HAVE_MPI_LARGE_COUNT], [Define if required MPI APIs have arguments of type MPI_Count])

AH_TOP([#ifndef _CONFIG_H
#define _CONFIG_H])
AH_TOP([#ifndef H_CONFIG
#define H_CONFIG])
AH_BOTTOM([#include <nctypes.h>
#endif])

Expand Down
6 changes: 4 additions & 2 deletions sneak_peek.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ This is essentially a placeholder for the next release note ...
+ none

* New constants
+ none
+ C macro NC_FillValue replaces _FillValue. This conforms with NetCDF4's
change in its version 4.9.3 release.
See [PR #153](https://github.com/Parallel-NetCDF/PnetCDF/pull/153).

* New APIs
+ none
Expand Down Expand Up @@ -63,7 +65,7 @@ This is essentially a placeholder for the next release note ...
+ Fix `pnetcdf-config` of reflecting the installation path when installation
is done by running command `make install DESTDIR=/alternate/directory`
which prepends '/alternate/directory' before all installation names.
See [PR #145](https://github.com/Parallel-NetCDF/PnetCDF/pull/154).
See [PR #154](https://github.com/Parallel-NetCDF/PnetCDF/pull/154).

* New example programs
+ C/flexible_bottom.c and C/vard_bottom.c - These two examples construct MPI
Expand Down
4 changes: 2 additions & 2 deletions src/binding/f77/mpinetcdf_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
/* $Id$ */

#ifndef _MPINETCDF_IMPL_H
#define _MPINETCDF_IMPL_H
#ifndef H_MPINETCDF_IMPL
#define H_MPINETCDF_IMPL

#ifdef HAVE_CONFIG_H
# include <config.h>
Expand Down
4 changes: 2 additions & 2 deletions src/dispatchers/attr_getput.m4
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ sanity_check_put(PNC *pncp,

#ifdef NO_NC_GLOBAL_FILLVALUE
/* See r3403 and RELEASE_NOTES 1.9.0 */
if (varid == NC_GLOBAL && !strcmp(name, _FillValue))
DEBUG_RETURN_ERROR(NC_EGLOBAL) /* global _FillValue is not allowed */
if (varid == NC_GLOBAL && !strcmp(name, "_FillValue"))
DEBUG_RETURN_ERROR(NC_EGLOBAL) /* global "_FillValue" is not allowed */
#endif

if (strlen(name) > NC_MAX_NAME) /* name length */
Expand Down
8 changes: 4 additions & 4 deletions src/dispatchers/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ ncmpi_create(MPI_Comm comm,
return status;
}

#define _NDIMS_ 16
#define NDIMS_ 16

/*----< ncmpi_open() >-------------------------------------------------------*/
/* This is a collective subroutine. */
Expand All @@ -549,7 +549,7 @@ ncmpi_open(MPI_Comm comm,
int *ncidp) /* OUT */
{
int i, j, nalloc, rank, nprocs, format, status=NC_NOERR, err;
int safe_mode=0, mpireturn, relax_coord_bound, DIMIDS[_NDIMS_], *dimids;
int safe_mode=0, mpireturn, relax_coord_bound, DIMIDS[NDIMS_], *dimids;
char *env_str;
MPI_Info combined_info;
void *ncp;
Expand Down Expand Up @@ -814,7 +814,7 @@ ncmpi_open(MPI_Comm comm,
*/

/* allocate chunk size for pncp->vars[] */
nalloc = _RNDUP(pncp->nvars, PNC_VARS_CHUNK);
nalloc = PNETCDF_RNDUP(pncp->nvars, PNC_VARS_CHUNK);
pncp->vars = NCI_Malloc(nalloc * sizeof(PNC_var));
if (pncp->vars == NULL) {
DEBUG_ASSIGN_ERROR(err, NC_ENOMEM)
Expand All @@ -825,7 +825,7 @@ ncmpi_open(MPI_Comm comm,

/* construct array of PNC_var for all variables */
for (i=0; i<pncp->nvars; i++) {
int ndims, max_ndims=_NDIMS_;
int ndims, max_ndims=NDIMS_;
pncp->vars[i].shape = NULL;
pncp->vars[i].recdim = -1; /* if fixed-size variable */
err = driver->inq_var(pncp->ncp, i, NULL, &pncp->vars[i].xtype, &ndims,
Expand Down
2 changes: 1 addition & 1 deletion src/dispatchers/variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ ncmpi_def_var_fill(int ncid, /* IN: file ID */
}

if (varid == NC_GLOBAL) {
/* setting global _FillValue through this API is not allowed */
/* setting global attribute _FillValue through this API is not allowed */
DEBUG_ASSIGN_ERROR(err, NC_EGLOBAL)
goto err_check;
}
Expand Down
18 changes: 9 additions & 9 deletions src/drivers/common/utf8proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ ncmpii_utf8_validate(const char* name)
#include "utf8proc_data.h"


#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT const utf8proc_int8_t utf8proc_utf8class[256] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
Expand Down Expand Up @@ -191,7 +191,7 @@ UTF8PROC_DLLEXPORT const utf8proc_int8_t utf8proc_utf8class[256] = {
be different, being based on ABI compatibility.): */
#define STRINGIZEx(x) #x
#define STRINGIZE(x) STRINGIZEx(x)
#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "";
}
Expand Down Expand Up @@ -263,7 +263,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_iterate(
return 4;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_codepoint_valid(utf8proc_int32_t uc) {
return (((utf8proc_uint32_t)uc)-0xd800 > 0x07ff) && ((utf8proc_uint32_t)uc < 0x110000);
}
Expand Down Expand Up @@ -336,7 +336,7 @@ static const utf8proc_property_t *unsafe_get_property(utf8proc_int32_t uc) {
);
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(utf8proc_int32_t uc) {
return uc < 0 || uc >= 0x110000 ? utf8proc_properties : unsafe_get_property(uc);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ static utf8proc_bool grapheme_break_extended(int lbc, int tbc, utf8proc_int32_t
return break_permitted;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break_stateful(
utf8proc_int32_t c1, utf8proc_int32_t c2, utf8proc_int32_t *state) {

Expand All @@ -444,7 +444,7 @@ static utf8proc_int32_t seqindex_decode_entry(const utf8proc_uint16_t **entry)
return entry_cp;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
static utf8proc_int32_t seqindex_decode_index(const utf8proc_uint32_t seqindex)
{
const utf8proc_uint16_t *entry = &utf8proc_sequences[seqindex];
Expand All @@ -471,7 +471,7 @@ static utf8proc_ssize_t seqindex_write_char_decomposed(utf8proc_uint16_t seqinde
return written;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT utf8proc_int32_t utf8proc_tolower(utf8proc_int32_t c)
{
utf8proc_int32_t cl = utf8proc_get_property(c)->lowercase_seqindex;
Expand Down Expand Up @@ -595,7 +595,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc,
return 1;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose(
const utf8proc_uint8_t *str, utf8proc_ssize_t strlen,
utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, utf8proc_option_t options
Expand Down Expand Up @@ -844,7 +844,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom(
return result;
}

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFD(const utf8proc_uint8_t *str) {
utf8proc_uint8_t *retval;
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/common/utf8proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ typedef bool utf8proc_bool;
#endif
#include <limits.h>

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
#ifdef _WIN32
# ifdef UTF8PROC_EXPORTS
# define UTF8PROC_DLLEXPORT __declspec(dllexport)
Expand All @@ -146,7 +146,7 @@ extern "C" {
# define UINT16_MAX 65535U
#endif

#ifdef _PNETCDF_H
#ifdef H_PNETCDF
/* silence Fujitsu compiler warning: enumerated type mixed with another type */
#define UTF8PROC_NULLTERM (1<<0)
#define UTF8PROC_STABLE (1<<1)
Expand Down Expand Up @@ -409,7 +409,7 @@ typedef enum {
*/
typedef utf8proc_int32_t (*utf8proc_custom_func)(utf8proc_int32_t codepoint, void *data);

#ifndef _PNETCDF_H
#ifndef H_PNETCDF
/**
* Array containing the byte lengths of a UTF-8 encoded codepoint based
* on the first byte.
Expand Down
14 changes: 7 additions & 7 deletions src/drivers/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
/* $Id$ */

#ifndef _COMMON_H
#define _COMMON_H
#ifndef H_COMMON
#define H_COMMON

#include <mpi.h>
#include <pnetcdf.h>
Expand All @@ -26,16 +26,16 @@
#endif

/* useful for aligning memory */
#define _RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit))
#define _RNDDOWN(x, unit) ((x) - ((x)%(unit)))
#define PNETCDF_RNDUP(x, unit) ((((x) + (unit) - 1) / (unit)) * (unit))
#define PNETCDF_RNDDOWN(x, unit) ((x) - ((x)%(unit)))

/* #define M_RND_UNIT (sizeof(double))
* SIZEOF_DOUBLE is defined in config.h
*/
#define M_RND_UNIT SIZEOF_DOUBLE
#define M_RNDUP(x) _RNDUP(x, M_RND_UNIT)
#define M_RNDDOWN(x) _RNDDOWN(x, M_RND_UNIT)
#define D_RNDUP(x, align) _RNDUP(x, (off_t)(align))
#define M_RNDUP(x) PNETCDF_RNDUP(x, M_RND_UNIT)
#define M_RNDDOWN(x) PNETCDF_RNDDOWN(x, M_RND_UNIT)
#define D_RNDUP(x, align) PNETCDF_RNDUP(x, (off_t)(align))

/* for put request less than 4KB, copy it to a buffer and do byte swap there,
* so if the user buffer is immutable (assuming smaller than 4KB), it will not
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/include/ncx_h.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dnl
*/
/* "$Id$" */

#ifndef _NCX_H
#define _NCX_H
#ifndef H_NCX
#define H_NCX

#include <stddef.h> /* size_t */
#include <sys/types.h> /* off_t */
Expand Down Expand Up @@ -373,4 +373,4 @@ ncmpix_putn_void(void **xpp, MPI_Offset nchars, const void *vp);
extern int
ncmpix_pad_putn_void(void **xpp, MPI_Offset nchars, const void *vp);

#endif /* _NCX_H_ */
#endif /* H_NCX */
4 changes: 2 additions & 2 deletions src/drivers/nc4io/nc4io_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
/* $Id$ */

#ifndef _nc4io_DRIVER_H
#define _nc4io_DRIVER_H
#ifndef H_nc4io_DRIVER
#define H_nc4io_DRIVER

#include <mpi.h>
#include <pnetcdf.h>
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ncadios/adios_headers/core/adios_timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* Copyright (c) 2008 - 2009. UT-BATTELLE, LLC. All rights reserved.
*/

#ifndef _ADIOS_TIMING_H_
#define _ADIOS_TIMING_H_
#ifndef H_ADIOS_TIMING
#define H_ADIOS_TIMING


#include <stdint.h>
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ncadios/adios_headers/core/qhashtbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
/*
Modified/simplified by ADIOS team for the purpose of variable/attribute store
*/
#ifndef __HASHTBL_H_
#define __HASHTBL_H_
#ifndef H_HASHTBL
#define H_HASHTBL

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ncadios/ncadios_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* See COPYRIGHT notice in top-level directory.
*/

#ifndef _ncadios_DRIVER_H
#define _ncadios_DRIVER_H
#ifndef H_ncadios_DRIVER
#define H_ncadios_DRIVER

#include <mpi.h>
#include <pnetcdf.h>
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ncbbio/ncbbio_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

/* $Id$ */

#ifndef _NCFOO_DRIVER_H
#define _NCFOO_DRIVER_H
#ifndef H_NCFOO_DRIVER
#define H_NCFOO_DRIVER

#include <dispatch.h>
#include <limits.h>
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/ncfoo/ncfoo_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
/* $Id$ */

#ifndef _NCFOO_DRIVER_H
#define _NCFOO_DRIVER_H
#ifndef H_NCFOO_DRIVER
#define H_NCFOO_DRIVER

#include <mpi.h>
#include <pnetcdf.h>
Expand Down
6 changes: 3 additions & 3 deletions src/drivers/ncmpio/ncmpio_NC.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
/* $Id$ */

#ifndef _NC_H
#define _NC_H
#ifndef H_NC
#define H_NC

/*
* netcdf library 'private' data structures, objects and interfaces
Expand Down Expand Up @@ -631,4 +631,4 @@ ncmpio_read_write(NC *ncp, int rw_flag, int coll_indep, MPI_Offset offset,
MPI_Offset buf_count, MPI_Datatype buf_type, void *buf,
int buftype_is_contig);

#endif /* _NC_H */
#endif /* H_NC */
8 changes: 4 additions & 4 deletions src/drivers/ncmpio/ncmpio_attr.m4
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ x_len_NC_attrV(nc_type xtype,
switch(xtype) {
case NC_BYTE:
case NC_CHAR:
case NC_UBYTE: return _RNDUP(nelems, 4);
case NC_UBYTE: return PNETCDF_RNDUP(nelems, 4);
case NC_SHORT:
case NC_USHORT: return ((nelems + nelems%2) * 2);
case NC_INT:
Expand Down Expand Up @@ -188,7 +188,7 @@ ncmpio_dup_NC_attrarray(NC_attrarray *ncap, const NC_attrarray *ref)
}

if (ref->ndefined > 0) {
size_t alloc_size = _RNDUP(ref->ndefined, PNC_ARRAY_GROWBY);
size_t alloc_size = PNETCDF_RNDUP(ref->ndefined, PNC_ARRAY_GROWBY);
ncap->value = (NC_attr **) NCI_Calloc(alloc_size, sizeof(NC_attr*));
if (ncap->value == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
}
Expand Down Expand Up @@ -980,10 +980,10 @@ ncmpio_put_att(void *ncdp,

/* sanity checks for varid, name, xtype has been done in dispatcher */

/* If this is the _FillValue attribute, then let PnetCDF return the
/* If this is attribute _FillValue, then let PnetCDF return the
* same error codes as netCDF
*/
if (varid != NC_GLOBAL && !strcmp(name, _FillValue)) {
if (varid != NC_GLOBAL && !strcmp(name, "_FillValue")) {
/* Fill value must be of the same data type */
if (xtype != ncp->vars.value[varid]->xtype) {
DEBUG_ASSIGN_ERROR(err, NC_EBADTYPE)
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/ncmpio/ncmpio_dim.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ncmpio_dup_NC_dimarray(NC_dimarray *ncap, const NC_dimarray *ref)

/* allocate array of NC_dim objects */
if (ref->ndefined > 0) {
size_t alloc_size = _RNDUP(ref->ndefined, PNC_ARRAY_GROWBY);
size_t alloc_size = PNETCDF_RNDUP(ref->ndefined, PNC_ARRAY_GROWBY);
ncap->value = (NC_dim**) NCI_Calloc(alloc_size, sizeof(NC_dim*));
if (ncap->value == NULL) DEBUG_RETURN_ERROR(NC_ENOMEM)
}
Expand Down
Loading
Loading