From e247b29913de26abef93de2133bf920bbfcd04f1 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 10 Oct 2021 06:42:58 -0400 Subject: try to fix the fallthrough warning --- uthash.h | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/uthash.h b/uthash.h index d6b54e9..02f6e0a 100644 --- a/uthash.h +++ b/uthash.h @@ -423,6 +423,15 @@ do { c -= a; c -= b; c ^= ( b >> 15 ); \ } while (0) +#if defined __has_cpp_attribute + #if __has_cpp_attribute(fallthrough) + #define fallthrough ([[fallthrough]];) + #endif +#endif +#ifndef fallthrough +#define fallthrough /* FALL-THRU */ +#endif + #define HASH_JEN(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _hj_i,_hj_j,_hj_k; \ @@ -449,25 +458,25 @@ do { hashv += keylen; \ switch ( _hj_k ) { \ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); \ - [[fallthrough]]; \ + fallthrough \ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); \ - [[fallthrough]]; \ + fallthrough \ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); \ - [[fallthrough]]; \ + fallthrough \ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); \ - [[fallthrough]]; \ + fallthrough \ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); \ - [[fallthrough]]; \ + fallthrough \ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); \ - [[fallthrough]]; \ + fallthrough \ case 5: _hj_j += _hj_key[4]; \ - [[fallthrough]]; \ + fallthrough \ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); \ - [[fallthrough]]; \ + fallthrough \ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); \ - [[fallthrough]]; \ + fallthrough \ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); \ - [[fallthrough]]; \ + fallthrough \ case 1: _hj_i += _hj_key[0]; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ -- cgit v1.2.3