fix mutex_trylock bug
[c11tester.git] / include / wildcard.h
1 #ifndef _WILDCARD_H
2 #define _WILDCARD_H
3 // #include "memoryorder.h"
4
5 #define MAX_WILDCARD_NUM 50
6
7 #define memory_order_normal ((memory_order) (0x2000))
8
9 #define memory_order_wildcard(x) ((memory_order) (0x1000+x))
10
11 #define wildcard(x) ((memory_order) (0x1000+x))
12 #define get_wildcard_id(x) ((int) (x-0x1000))
13 #define get_wildcard_id_zero(x) ((get_wildcard_id(x)) > 0 ? get_wildcard_id(x) : 0)
14
15 #define INIT_WILDCARD_NUM 20
16 #define WILDCARD_NONEXIST (memory_order) -1
17 #define INFERENCE_INCOMPARABLE(x) (!(-1 <= (x) <= 1))
18
19 #define is_wildcard(x) (!(x >= memory_order_relaxed && x <= memory_order_seq_cst) && x != memory_order_normal)
20 #define is_normal_mo_infer(x) ((x >= memory_order_relaxed && x <= memory_order_seq_cst) || x == WILDCARD_NONEXIST || x == memory_order_normal)
21 #define is_normal_mo(x) ((x >= memory_order_relaxed && x <= memory_order_seq_cst) || x == memory_order_normal)
22
23 #define assert_infer(x) for (int i = 0;i <= wildcardNum;i++) \
24                 ASSERT(is_normal_mo_infer((x[i])));
25
26 #define assert_infers(x) for (ModelList<memory_order *>::iterator iter = \
27                                                                                                                                 (x)->begin();iter != (x)->end();iter++) \
28                 assert_infer((*iter));
29
30 #define relaxed memory_order_relaxed
31 #define release memory_order_release
32 #define acquire memory_order_acquire
33 #define seqcst memory_order_seq_cst
34 #define acqrel memory_order_acq_rel
35
36 #endif