3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-14 21:08:46 +00:00

Merge pull request #238 from nunoplopes/master

use Z3_fallthrough instead of __falthrough directly
This commit is contained in:
Christoph M. Wintersteiger 2015-10-09 18:42:26 +01:00
commit 2d2ec38541
7 changed files with 28 additions and 24 deletions

View file

@ -516,7 +516,7 @@ inline unsigned ast_array_hash(T * const * array, unsigned size, unsigned init_v
switch (size) { switch (size) {
case 2: case 2:
b += array[1]->hash(); b += array[1]->hash();
__fallthrough; Z3_fallthrough;
case 1: case 1:
c += array[0]->hash(); c += array[0]->hash();
} }

View file

@ -1500,7 +1500,7 @@ br_status bv_rewriter::mk_bv_xor(unsigned num, expr * const * args, expr_ref & r
result = m_util.mk_bv_not(new_args[1]); result = m_util.mk_bv_not(new_args[1]);
return BR_DONE; return BR_DONE;
} }
__fallthrough; Z3_fallthrough;
default: default:
if (m_bv_sort_ac) if (m_bv_sort_ac)
std::sort(new_args.begin(), new_args.end(), ast_to_lt()); std::sort(new_args.begin(), new_args.end(), ast_to_lt());

View file

@ -67,7 +67,7 @@ namespace smt {
switch (num_args) { switch (num_args) {
case 2: case 2:
b += arg_hash(n, 1); b += arg_hash(n, 1);
__fallthrough; Z3_fallthrough;
case 1: case 1:
c += arg_hash(n, 0); c += arg_hash(n, 0);
} }

View file

@ -127,7 +127,7 @@ namespace smt {
switch (i) { switch (i) {
case 2: case 2:
b += n->get_arg(1)->get_root()->hash(); b += n->get_arg(1)->get_root()->hash();
__fallthrough; Z3_fallthrough;
case 1: case 1:
c += n->get_arg(0)->get_root()->hash(); c += n->get_arg(0)->get_root()->hash();
} }

View file

@ -52,38 +52,38 @@ unsigned string_hash(const char * str, unsigned length, unsigned init_value) {
switch(len) { /* all the case statements fall through */ switch(len) { /* all the case statements fall through */
case 11: case 11:
c+=((unsigned)str[10]<<24); c+=((unsigned)str[10]<<24);
__fallthrough; Z3_fallthrough;
case 10: case 10:
c+=((unsigned)str[9]<<16); c+=((unsigned)str[9]<<16);
__fallthrough; Z3_fallthrough;
case 9 : case 9 :
c+=((unsigned)str[8]<<8); c+=((unsigned)str[8]<<8);
__fallthrough; Z3_fallthrough;
/* the first byte of c is reserved for the length */ /* the first byte of c is reserved for the length */
case 8 : case 8 :
b+=((unsigned)str[7]<<24); b+=((unsigned)str[7]<<24);
__fallthrough; Z3_fallthrough;
case 7 : case 7 :
b+=((unsigned)str[6]<<16); b+=((unsigned)str[6]<<16);
__fallthrough; Z3_fallthrough;
case 6 : case 6 :
b+=((unsigned)str[5]<<8); b+=((unsigned)str[5]<<8);
__fallthrough; Z3_fallthrough;
case 5 : case 5 :
b+=str[4]; b+=str[4];
__fallthrough; Z3_fallthrough;
case 4 : case 4 :
a+=((unsigned)str[3]<<24); a+=((unsigned)str[3]<<24);
__fallthrough; Z3_fallthrough;
case 3 : case 3 :
a+=((unsigned)str[2]<<16); a+=((unsigned)str[2]<<16);
__fallthrough; Z3_fallthrough;
case 2 : case 2 :
a+=((unsigned)str[1]<<8); a+=((unsigned)str[1]<<8);
__fallthrough; Z3_fallthrough;
case 1 : case 1 :
a+=str[0]; a+=str[0];
__fallthrough; Z3_fallthrough;
/* case 0: nothing left to add */ /* case 0: nothing left to add */
} }
mix(a,b,c); mix(a,b,c);

View file

@ -22,10 +22,6 @@ Revision History:
#include<algorithm> #include<algorithm>
#include"util.h" #include"util.h"
#ifndef __fallthrough
#define __fallthrough
#endif
#define mix(a,b,c) \ #define mix(a,b,c) \
{ \ { \
a -= b; a -= c; a ^= (c>>13); \ a -= b; a -= c; a ^= (c>>13); \
@ -116,7 +112,7 @@ unsigned get_composite_hash(Composite app, unsigned n, GetKindHashProc const & k
switch (n) { switch (n) {
case 2: case 2:
b += chasher(app, 1); b += chasher(app, 1);
__fallthrough; Z3_fallthrough;
case 1: case 1:
c += chasher(app, 0); c += chasher(app, 0);
} }

View file

@ -68,6 +68,18 @@ COMPILE_TIME_ASSERT(sizeof(int64) == 8);
#define THREAD_LOCAL #define THREAD_LOCAL
#endif #endif
#ifdef __fallthrough
# define Z3_fallthrough __fallthrough
#elif defined(__has_cpp_attribute)
# if __has_cpp_attribute(clang::fallthrough)
# define Z3_fallthrough [[clang::fallthrough]]
# else
# define Z3_fallthrough
# endif
#else
# define Z3_fallthrough
#endif
inline bool is_power_of_two(unsigned v) { return !(v & (v - 1)) && v; } inline bool is_power_of_two(unsigned v) { return !(v & (v - 1)) && v; }
/** /**
@ -273,10 +285,6 @@ bool has_duplicates(const IT & begin, const IT & end) {
return false; return false;
} }
#ifndef __fallthrough
#define __fallthrough
#endif
#ifndef _WINDOWS #ifndef _WINDOWS
#ifndef __declspec #ifndef __declspec
#define __declspec(X) #define __declspec(X)