diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-11-13 04:36:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-13 04:36:32 (GMT) |
commit | d224f98dbc63104b523186c9b708c2a05f6e4374 (patch) | |
tree | b8396445648acd3c5f0cfe0dda215ce4cced0d2a /src/H5HF.c | |
parent | 08b1c6ac3c7d65fe5bfc1d70b68f66d633fa5999 (diff) | |
download | hdf5-d224f98dbc63104b523186c9b708c2a05f6e4374.zip hdf5-d224f98dbc63104b523186c9b708c2a05f6e4374.tar.gz hdf5-d224f98dbc63104b523186c9b708c2a05f6e4374.tar.bz2 |
Quiets most const warnings in the fractal heap code (#1188)
Diffstat (limited to 'src/H5HF.c')
-rw-r--r-- | src/H5HF.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -114,8 +114,14 @@ H5HF__op_write(const void *obj, size_t obj_len, void *op_data) { FUNC_ENTER_PACKAGE_NOERR - /* Perform "write", using memcpy() */ - H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */ + /* Perform "write", using memcpy() + * + * We cast away const here because no obj pointer that was originally + * const should ever arrive here. + */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") + H5MM_memcpy((void *)obj, op_data, obj_len); + H5_GCC_CLANG_DIAG_ON("cast-qual") FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__op_write() */ @@ -347,10 +353,15 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/) /* Check for 'huge' object */ if (size > hdr->max_man_size) { - /* Store 'huge' object in heap */ - /* (Casting away const OK - QAK) */ + /* Store 'huge' object in heap + * + * Although not ideal, we can quiet the const warning here becuase no + * obj pointer that was originally const should ever arrive here. + */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5HF__huge_insert(hdr, size, (void *)obj, id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap") + H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ /* Check for 'tiny' object */ else if (size <= hdr->tiny_max_len) { |