summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Joe Lee <hyoklee@hdfgroup.org>2021-11-05 13:31:01 (GMT)
committerGitHub <noreply@github.com>2021-11-05 13:31:01 (GMT)
commita8d03d30ffae22682d044782a17cefa1854de8ea (patch)
tree75c5ad5a33460bfead9bf3b14be83c3cdcbd8ee0
parentb3f35a97a9e2f1f0592fa22c1fbbe950ff8efc22 (diff)
downloadhdf5-a8d03d30ffae22682d044782a17cefa1854de8ea.zip
hdf5-a8d03d30ffae22682d044782a17cefa1854de8ea.tar.gz
hdf5-a8d03d30ffae22682d044782a17cefa1854de8ea.tar.bz2
OESS-168: Remove clang warnings. (#1124)
* OESS-168: Remove clang warnings. * OESS-168: Remove clang warnings. * Committing clang-format changes * OESS-168: Address @derobins review for FALLTHROUGH. Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r--src/H5private.h4
-rw-r--r--src/uthash.h30
2 files changed, 22 insertions, 12 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 2318f10..792cf00 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -252,10 +252,10 @@
#define H5_ATTR_NORETURN __attribute__((noreturn))
#define H5_ATTR_CONST __attribute__((const))
#define H5_ATTR_PURE __attribute__((pure))
-#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
+#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
-#define H5_ATTR_FALLTHROUGH /*void*/
+#define H5_ATTR_FALLTHROUGH /* FALLTHROUGH */
#endif
#else
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
diff --git a/src/uthash.h b/src/uthash.h
index 8bdca55..ea99839 100644
--- a/src/uthash.h
+++ b/src/uthash.h
@@ -714,25 +714,35 @@ typedef unsigned char uint8_t;
hashv += (unsigned)(keylen); \
switch (_hj_k) { \
case 11: \
- hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[10] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 10: \
- hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[9] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 9: \
- hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[8] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 8: \
- _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[7] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 7: \
- _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[6] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 6: \
- _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[5] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 5: \
- _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
+ _hj_j += _hj_key[4]; \
+ H5_ATTR_FALLTHROUGH \
case 4: \
- _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[3] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 3: \
- _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[2] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 2: \
- _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[1] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 1: \
_hj_i += _hj_key[0]; \
} \