1 // Validate that the __sync builtins are overloaded properly in templates.
3 // { dg-options "-Werror" }
6 #define TEST1(BUILTIN) \
8 void f##BUILTIN(T *p) \
10 __typeof(BUILTIN(p, 1)) *pp; \
14 TEST1(__sync_fetch_and_add)
15 TEST1(__sync_fetch_and_sub)
16 TEST1(__sync_fetch_and_or)
17 TEST1(__sync_fetch_and_and)
18 TEST1(__sync_fetch_and_xor)
19 TEST1(__sync_fetch_and_nand)
21 TEST1(__sync_add_and_fetch)
22 TEST1(__sync_sub_and_fetch)
23 TEST1(__sync_or_and_fetch)
24 TEST1(__sync_and_and_fetch)
25 TEST1(__sync_xor_and_fetch)
26 TEST1(__sync_nand_and_fetch)
28 TEST1(__sync_lock_test_and_set)
31 void f__sync_val_compare_and_swap(T *p)
33 __typeof(__sync_val_compare_and_swap(p, 1, 2)) *pp;
41 f__sync_fetch_and_add (&x); \
42 f__sync_fetch_and_sub (&x); \
43 f__sync_fetch_and_or (&x); \
44 f__sync_fetch_and_and (&x); \
45 f__sync_fetch_and_xor (&x); \
46 f__sync_fetch_and_nand (&x); \
47 f__sync_add_and_fetch (&x); \
48 f__sync_sub_and_fetch (&x); \
49 f__sync_or_and_fetch (&x); \
50 f__sync_and_and_fetch (&x); \
51 f__sync_xor_and_fetch (&x); \
52 f__sync_nand_and_fetch (&x); \
53 f__sync_lock_test_and_set (&x); \
54 f__sync_val_compare_and_swap (&x); \