diff options
author | Sean McBride <sean@rogue-research.com> | 2021-02-25 18:15:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-25 18:15:02 (GMT) |
commit | c29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e (patch) | |
tree | 59c16ade26ea62e2ffc89506e1a245b4f296b82e /src | |
parent | c17b4b93d680340af2b3f2c026f2c03c3baeb33a (diff) | |
download | hdf5-c29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e.zip hdf5-c29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e.tar.gz hdf5-c29e1b9fdfcba9ca276600b1bad4ec2cf17bb01e.tar.bz2 |
Patches from vtk (#358)
* Drop the export attribute on forward declaration
They don't mean anything on forward declarations anyways.
* Fixed -Wunused-parameter warnings in some C++ files
Allowed all the attribute #defines to work in C++ also.
* Fixed -Wunused-variable warnings by removing dead code
* Fixed all -Wshorten-64-to-32 warnings by adjusting casts
There was no truncation in fact, since the unsigned result was upcast to size_t then implicitly downcast to uint32_t.
* Fixed all -Wcomma warnings by spliting statements onto own lines
* Fixed all -Wself-assign warnings with different unused param suppression
* Fixed all -Wextra-semi warnings
* Fixed all -Wswitch-enum warnings
Just added new explicit cases with the existing default case.
* Fixed all -Wmissing-prototypes warnings
Just made functions static. Moved them into an extern "C" block.
* Reformatted source with bin/format_source using clang version 10.0.1
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Cimage.c | 3 | ||||
-rw-r--r-- | src/H5FDmulti.c | 2 | ||||
-rw-r--r-- | src/H5FDstdio.c | 32 | ||||
-rw-r--r-- | src/H5HFhuge.c | 28 | ||||
-rw-r--r-- | src/H5VLpassthru.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 14 |
6 files changed, 34 insertions, 47 deletions
diff --git a/src/H5Cimage.c b/src/H5Cimage.c index b49f192..b366a94 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -1158,7 +1158,8 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); /* Set information needed to load cache image */ - cache_ptr->image_addr = addr, cache_ptr->image_len = len; + cache_ptr->image_addr = addr; + cache_ptr->image_len = len; cache_ptr->load_image = TRUE; cache_ptr->delete_image = rw; diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index b61b193..e468554 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1195,7 +1195,7 @@ static herr_t H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) { /* Shut compiler up */ - _f = _f; + (void)_f; /* Set the VFL feature flags that this driver supports */ if (flags) { diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index b9d018a..efc1802 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -346,7 +346,7 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr assert(sizeof(file_offset_t) >= sizeof(size_t)); /* Quiet compiler */ - fapl_id = fapl_id; + (void)fapl_id; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -587,7 +587,7 @@ static herr_t H5FD_stdio_query(const H5FD_t *_f, unsigned long /*OUT*/ *flags) { /* Quiet the compiler */ - _f = _f; + (void)_f; /* Set the VFL feature flags that this driver supports. * @@ -632,8 +632,8 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp haddr_t addr; /* Quiet compiler */ - type = type; - dxpl_id = dxpl_id; + (void)type; + (void)dxpl_id; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -671,7 +671,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) H5Eclear2(H5E_DEFAULT); /* Quiet compiler */ - type = type; + (void)type; return file->eoa; } /* end H5FD_stdio_get_eoa() */ @@ -701,7 +701,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr) H5Eclear2(H5E_DEFAULT); /* Quiet the compiler */ - type = type; + (void)type; file->eoa = addr; @@ -732,13 +732,13 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Quiet the compiler */ - type = type; + (void)type; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); /* Quiet the compiler */ - type = type; + (void)type; return (file->eof); } /* end H5FD_stdio_get_eof() */ @@ -762,7 +762,7 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle) static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */ /* Quiet the compiler */ - fapl = fapl; + (void)fapl; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -800,8 +800,8 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */ /* Quiet the compiler */ - type = type; - dxpl_id = dxpl_id; + (void)type; + (void)dxpl_id; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -902,8 +902,8 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */ /* Quiet the compiler */ - dxpl_id = dxpl_id; - type = type; + (void)dxpl_id; + (void)type; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -990,7 +990,7 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing) static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ /* Quiet the compiler */ - dxpl_id = dxpl_id; + (void)dxpl_id; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1034,8 +1034,8 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */ /* Quiet the compiler */ - dxpl_id = dxpl_id; - closing = closing; + (void)dxpl_id; + (void)closing; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 1e1b066..83a61ec 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -113,32 +113,32 @@ H5HF__huge_bt2_create(H5HF_hdr_t *hdr) if (hdr->huge_ids_direct) { if (hdr->filter_len > 0) { bt2_cparam.rrec_size = - (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ - + (unsigned)hdr->sizeof_size /* Length of object */ - + (unsigned)4 /* Filter mask for filtered object */ - + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */ + (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size); /* Size of de-filtered object in memory */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_DIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ - + (unsigned)hdr->sizeof_size); /* Length of object */ + bt2_cparam.rrec_size = (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size); /* Length of object */ bt2_cparam.cls = H5HF_HUGE_BT2_DIR; } /* end else */ } /* end if */ else { if (hdr->filter_len > 0) { bt2_cparam.rrec_size = - (size_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */ - + (unsigned)hdr->sizeof_size /* Length of filtered object */ - + (unsigned)4 /* Filter mask for filtered object */ - + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */ - + (unsigned)hdr->sizeof_size); /* Unique ID for object */ + (uint32_t)((unsigned)hdr->sizeof_addr /* Address of filtered object */ + + (unsigned)hdr->sizeof_size /* Length of filtered object */ + + (unsigned)4 /* Filter mask for filtered object */ + + (unsigned)hdr->sizeof_size /* Size of de-filtered object in memory */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_FILT_INDIR; } /* end if */ else { - bt2_cparam.rrec_size = (size_t)((unsigned)hdr->sizeof_addr /* Address of object */ - + (unsigned)hdr->sizeof_size /* Length of object */ - + (unsigned)hdr->sizeof_size); /* Unique ID for object */ + bt2_cparam.rrec_size = (uint32_t)((unsigned)hdr->sizeof_addr /* Address of object */ + + (unsigned)hdr->sizeof_size /* Length of object */ + + (unsigned)hdr->sizeof_size); /* Unique ID for object */ bt2_cparam.cls = H5HF_HUGE_BT2_INDIR; } /* end else */ } /* end else */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index d73f7c5..5ccc082 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -488,7 +488,7 @@ H5VL_pass_through_init(hid_t vipl_id) #endif /* Shut compiler up about unused parameter */ - vipl_id = vipl_id; + (void)vipl_id; return 0; } /* end H5VL_pass_through_init() */ diff --git a/src/H5private.h b/src/H5private.h index e850523..741214f 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -306,19 +306,6 @@ * gcc warnings (it has to use the public API and can't include this * file). Be sure to update that file if the #ifdefs change here. */ -#ifdef __cplusplus -#define H5_ATTR_FORMAT(X, Y, Z) /*void*/ -#define H5_ATTR_UNUSED /*void*/ -#define H5_ATTR_DEPRECATED_USED /*void*/ -#define H5_ATTR_NDEBUG_UNUSED /*void*/ -#define H5_ATTR_DEBUG_API_USED /*void*/ -#define H5_ATTR_PARALLEL_UNUSED /*void*/ -#define H5_ATTR_PARALLEL_USED /*void*/ -#define H5_ATTR_NORETURN /*void*/ -#define H5_ATTR_CONST /*void*/ -#define H5_ATTR_PURE /*void*/ -#define H5_ATTR_FALLTHROUGH /*void*/ -#else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) #define H5_ATTR_FORMAT(X, Y, Z) __attribute__((format(X, Y, Z))) #define H5_ATTR_UNUSED __attribute__((unused)) @@ -365,7 +352,6 @@ #define H5_ATTR_PURE /*void*/ #define H5_ATTR_FALLTHROUGH /*void*/ #endif -#endif /* __cplusplus */ /* * Networking headers used by the mirror VFD and related tests and utilities. |