Skip to content

Commit 3ccf1b0

Browse files
authored
Merge pull request #153 from Parallel-NetCDF/c99_macro
replace C macros beginning with _ and an uppercase
2 parents 82bea74 + 70ba6dc commit 3ccf1b0

38 files changed

+135
-132
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ Northwestern University and Argonne National Laboratory.
7474
* [E3SM I/O kernel study](https://github.com/Parallel-NetCDF/E3SM-IO)
7575
* [Scorpio](https://github.com/E3SM-Project/scorpio), the I/O module of E3SM.
7676
* [PIO](https://github.com/NCAR/ParallelIO) - parallel I/O library at NCAR.
77-
* [WRF](https://github.com/wrf-model/WRF/tree/master/external/io_pnetcdf)
78-
- Weather Research & Forecasting Model at NCAR.
77+
* [WRF](https://github.com/wrf-model/WRF/tree/master/external/io_pnetcdf) -
78+
Weather Research & Forecasting Model at NCAR.
7979

8080

8181
### Acknowledgements

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ AH_TEMPLATE([ENABLE_REQ_AGGREGATION], [Define if able to support request aggre
151151
dnl AH_TEMPLATE([HAVE_MPI_COUNT], [Define if type MPI_Count is defined])
152152
AH_TEMPLATE([HAVE_MPI_LARGE_COUNT], [Define if required MPI APIs have arguments of type MPI_Count])
153153

154-
AH_TOP([#ifndef _CONFIG_H
155-
#define _CONFIG_H])
154+
AH_TOP([#ifndef H_CONFIG
155+
#define H_CONFIG])
156156
AH_BOTTOM([#include <nctypes.h>
157157
#endif])
158158

sneak_peek.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ This is essentially a placeholder for the next release note ...
2424
+ none
2525

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

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

6870
* New example programs
6971
+ C/flexible_bottom.c and C/vard_bottom.c - These two examples construct MPI

src/binding/f77/mpinetcdf_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
/* $Id$ */
77

8-
#ifndef _MPINETCDF_IMPL_H
9-
#define _MPINETCDF_IMPL_H
8+
#ifndef H_MPINETCDF_IMPL
9+
#define H_MPINETCDF_IMPL
1010

1111
#ifdef HAVE_CONFIG_H
1212
# include <config.h>

src/dispatchers/attr_getput.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ sanity_check_put(PNC *pncp,
6464

6565
#ifdef NO_NC_GLOBAL_FILLVALUE
6666
/* See r3403 and RELEASE_NOTES 1.9.0 */
67-
if (varid == NC_GLOBAL && !strcmp(name, _FillValue))
68-
DEBUG_RETURN_ERROR(NC_EGLOBAL) /* global _FillValue is not allowed */
67+
if (varid == NC_GLOBAL && !strcmp(name, "_FillValue"))
68+
DEBUG_RETURN_ERROR(NC_EGLOBAL) /* global "_FillValue" is not allowed */
6969
#endif
7070

7171
if (strlen(name) > NC_MAX_NAME) /* name length */

src/dispatchers/file.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ ncmpi_create(MPI_Comm comm,
537537
return status;
538538
}
539539

540-
#define _NDIMS_ 16
540+
#define NDIMS_ 16
541541

542542
/*----< ncmpi_open() >-------------------------------------------------------*/
543543
/* This is a collective subroutine. */
@@ -549,7 +549,7 @@ ncmpi_open(MPI_Comm comm,
549549
int *ncidp) /* OUT */
550550
{
551551
int i, j, nalloc, rank, nprocs, format, status=NC_NOERR, err;
552-
int safe_mode=0, mpireturn, relax_coord_bound, DIMIDS[_NDIMS_], *dimids;
552+
int safe_mode=0, mpireturn, relax_coord_bound, DIMIDS[NDIMS_], *dimids;
553553
char *env_str;
554554
MPI_Info combined_info;
555555
void *ncp;
@@ -814,7 +814,7 @@ ncmpi_open(MPI_Comm comm,
814814
*/
815815

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

826826
/* construct array of PNC_var for all variables */
827827
for (i=0; i<pncp->nvars; i++) {
828-
int ndims, max_ndims=_NDIMS_;
828+
int ndims, max_ndims=NDIMS_;
829829
pncp->vars[i].shape = NULL;
830830
pncp->vars[i].recdim = -1; /* if fixed-size variable */
831831
err = driver->inq_var(pncp->ncp, i, NULL, &pncp->vars[i].xtype, &ndims,

src/dispatchers/variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ ncmpi_def_var_fill(int ncid, /* IN: file ID */
256256
}
257257

258258
if (varid == NC_GLOBAL) {
259-
/* setting global _FillValue through this API is not allowed */
259+
/* setting global attribute _FillValue through this API is not allowed */
260260
DEBUG_ASSIGN_ERROR(err, NC_EGLOBAL)
261261
goto err_check;
262262
}

src/drivers/common/utf8proc.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ ncmpii_utf8_validate(const char* name)
146146
#include "utf8proc_data.h"
147147

148148

149-
#ifndef _PNETCDF_H
149+
#ifndef H_PNETCDF
150150
UTF8PROC_DLLEXPORT const utf8proc_int8_t utf8proc_utf8class[256] = {
151151
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
152152
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -191,7 +191,7 @@ UTF8PROC_DLLEXPORT const utf8proc_int8_t utf8proc_utf8class[256] = {
191191
be different, being based on ABI compatibility.): */
192192
#define STRINGIZEx(x) #x
193193
#define STRINGIZE(x) STRINGIZEx(x)
194-
#ifndef _PNETCDF_H
194+
#ifndef H_PNETCDF
195195
UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
196196
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "";
197197
}
@@ -263,7 +263,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_iterate(
263263
return 4;
264264
}
265265

266-
#ifndef _PNETCDF_H
266+
#ifndef H_PNETCDF
267267
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_codepoint_valid(utf8proc_int32_t uc) {
268268
return (((utf8proc_uint32_t)uc)-0xd800 > 0x07ff) && ((utf8proc_uint32_t)uc < 0x110000);
269269
}
@@ -336,7 +336,7 @@ static const utf8proc_property_t *unsafe_get_property(utf8proc_int32_t uc) {
336336
);
337337
}
338338

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

420-
#ifndef _PNETCDF_H
420+
#ifndef H_PNETCDF
421421
UTF8PROC_DLLEXPORT utf8proc_bool utf8proc_grapheme_break_stateful(
422422
utf8proc_int32_t c1, utf8proc_int32_t c2, utf8proc_int32_t *state) {
423423

@@ -444,7 +444,7 @@ static utf8proc_int32_t seqindex_decode_entry(const utf8proc_uint16_t **entry)
444444
return entry_cp;
445445
}
446446

447-
#ifndef _PNETCDF_H
447+
#ifndef H_PNETCDF
448448
static utf8proc_int32_t seqindex_decode_index(const utf8proc_uint32_t seqindex)
449449
{
450450
const utf8proc_uint16_t *entry = &utf8proc_sequences[seqindex];
@@ -471,7 +471,7 @@ static utf8proc_ssize_t seqindex_write_char_decomposed(utf8proc_uint16_t seqinde
471471
return written;
472472
}
473473

474-
#ifndef _PNETCDF_H
474+
#ifndef H_PNETCDF
475475
UTF8PROC_DLLEXPORT utf8proc_int32_t utf8proc_tolower(utf8proc_int32_t c)
476476
{
477477
utf8proc_int32_t cl = utf8proc_get_property(c)->lowercase_seqindex;
@@ -595,7 +595,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose_char(utf8proc_int32_t uc,
595595
return 1;
596596
}
597597

598-
#ifndef _PNETCDF_H
598+
#ifndef H_PNETCDF
599599
UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_decompose(
600600
const utf8proc_uint8_t *str, utf8proc_ssize_t strlen,
601601
utf8proc_int32_t *buffer, utf8proc_ssize_t bufsize, utf8proc_option_t options
@@ -844,7 +844,7 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8proc_map_custom(
844844
return result;
845845
}
846846

847-
#ifndef _PNETCDF_H
847+
#ifndef H_PNETCDF
848848
UTF8PROC_DLLEXPORT utf8proc_uint8_t *utf8proc_NFD(const utf8proc_uint8_t *str) {
849849
utf8proc_uint8_t *retval;
850850
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |

src/drivers/common/utf8proc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ typedef bool utf8proc_bool;
120120
#endif
121121
#include <limits.h>
122122

123-
#ifndef _PNETCDF_H
123+
#ifndef H_PNETCDF
124124
#ifdef _WIN32
125125
# ifdef UTF8PROC_EXPORTS
126126
# define UTF8PROC_DLLEXPORT __declspec(dllexport)
@@ -146,7 +146,7 @@ extern "C" {
146146
# define UINT16_MAX 65535U
147147
#endif
148148

149-
#ifdef _PNETCDF_H
149+
#ifdef H_PNETCDF
150150
/* silence Fujitsu compiler warning: enumerated type mixed with another type */
151151
#define UTF8PROC_NULLTERM (1<<0)
152152
#define UTF8PROC_STABLE (1<<1)
@@ -409,7 +409,7 @@ typedef enum {
409409
*/
410410
typedef utf8proc_int32_t (*utf8proc_custom_func)(utf8proc_int32_t codepoint, void *data);
411411

412-
#ifndef _PNETCDF_H
412+
#ifndef H_PNETCDF
413413
/**
414414
* Array containing the byte lengths of a UTF-8 encoded codepoint based
415415
* on the first byte.

src/drivers/include/common.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
*/
55
/* $Id$ */
66

7-
#ifndef _COMMON_H
8-
#define _COMMON_H
7+
#ifndef H_COMMON
8+
#define H_COMMON
99

1010
#include <mpi.h>
1111
#include <pnetcdf.h>
@@ -26,16 +26,16 @@
2626
#endif
2727

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

3232
/* #define M_RND_UNIT (sizeof(double))
3333
* SIZEOF_DOUBLE is defined in config.h
3434
*/
3535
#define M_RND_UNIT SIZEOF_DOUBLE
36-
#define M_RNDUP(x) _RNDUP(x, M_RND_UNIT)
37-
#define M_RNDDOWN(x) _RNDDOWN(x, M_RND_UNIT)
38-
#define D_RNDUP(x, align) _RNDUP(x, (off_t)(align))
36+
#define M_RNDUP(x) PNETCDF_RNDUP(x, M_RND_UNIT)
37+
#define M_RNDDOWN(x) PNETCDF_RNDDOWN(x, M_RND_UNIT)
38+
#define D_RNDUP(x, align) PNETCDF_RNDUP(x, (off_t)(align))
3939

4040
/* for put request less than 4KB, copy it to a buffer and do byte swap there,
4141
* so if the user buffer is immutable (assuming smaller than 4KB), it will not

0 commit comments

Comments
 (0)