summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-06-12 19:36:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-06-12 19:36:01 (GMT)
commitc7ad57374b5a3633e32a6675a8ca8345d626aaba (patch)
tree8fb34cde148119337435351e52f4f82d36e4959c /src
parent7dcf5b39721c7c230c07a403ea8e91f7fa2206d2 (diff)
downloadhdf5-c7ad57374b5a3633e32a6675a8ca8345d626aaba.zip
hdf5-c7ad57374b5a3633e32a6675a8ca8345d626aaba.tar.gz
hdf5-c7ad57374b5a3633e32a6675a8ca8345d626aaba.tar.bz2
[svn-r15209] Description:
Bring back revision 15208 from trunk: Add a "HDcompile_assert" macro for assertions that can/should be checked at compile time, as opposed to run time. (And used it for a couple of simple cases, to begin) Tested on: Mac OS X/32 10.5.3 (amazon)
Diffstat (limited to 'src')
-rw-r--r--src/H5Distore.c12
-rw-r--r--src/H5private.h3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c
index eca6fc0..a217a41 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -1036,12 +1036,12 @@ H5D_istore_idx_iterate_cb(H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
FUNC_ENTER_NOAPI_NOINIT(H5D_istore_idx_iterate_cb)
/* Sanity check for memcpy() */
- HDassert(offsetof(H5D_chunk_rec_t, nbytes) == offsetof(H5D_istore_key_t, nbytes));
- HDassert(sizeof(chunk_rec.nbytes) == sizeof(lt_key->nbytes));
- HDassert(offsetof(H5D_chunk_rec_t, offset) == offsetof(H5D_istore_key_t, offset));
- HDassert(sizeof(chunk_rec.offset) == sizeof(lt_key->offset));
- HDassert(offsetof(H5D_chunk_rec_t, filter_mask) == offsetof(H5D_istore_key_t, filter_mask));
- HDassert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask));
+ HDcompile_assert(offsetof(H5D_chunk_rec_t, nbytes) == offsetof(H5D_istore_key_t, nbytes));
+ HDcompile_assert(sizeof(chunk_rec.nbytes) == sizeof(lt_key->nbytes));
+ HDcompile_assert(offsetof(H5D_chunk_rec_t, offset) == offsetof(H5D_istore_key_t, offset));
+ HDcompile_assert(sizeof(chunk_rec.offset) == sizeof(lt_key->offset));
+ HDcompile_assert(offsetof(H5D_chunk_rec_t, filter_mask) == offsetof(H5D_istore_key_t, filter_mask));
+ HDcompile_assert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask));
/* Compose generic chunk record for callback */
HDmemcpy(&chunk_rec, lt_key, sizeof(*lt_key));
diff --git a/src/H5private.h b/src/H5private.h
index 162feec..39ed8ce 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1882,6 +1882,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void);
#define H5_GLUE(x,y) x##y
#define H5_GLUE3(x,y,z) x##y##z
+/* Compile-time "assert" macro */
+#define HDcompile_assert(e) do { enum { compile_assert__ = 1 / (e) }; } while(0)
+
/* Private functions, not part of the publicly documented API */
H5_DLL herr_t H5_init_library(void);
H5_DLL void H5_term_library(void);