comparison gcc/testsuite/gcc.dg/sync-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* Validate that the __sync builtins are overloaded properly. */
2 /* { dg-do compile } */
3 /* { dg-options "-Werror" } */
4
5 #define TEST1(TYPE, BUILTIN) \
6 void t_##TYPE##BUILTIN(TYPE *p) \
7 { \
8 __typeof(BUILTIN(p, 1)) *pp; \
9 pp = p; \
10 }
11
12 #define TEST2(BUILTIN) \
13 TEST1(int, BUILTIN) \
14 TEST1(long, BUILTIN)
15
16 TEST2(__sync_fetch_and_add)
17 TEST2(__sync_fetch_and_sub)
18 TEST2(__sync_fetch_and_or)
19 TEST2(__sync_fetch_and_and)
20 TEST2(__sync_fetch_and_xor)
21 TEST2(__sync_fetch_and_nand)
22
23 TEST2(__sync_add_and_fetch)
24 TEST2(__sync_sub_and_fetch)
25 TEST2(__sync_or_and_fetch)
26 TEST2(__sync_and_and_fetch)
27 TEST2(__sync_xor_and_fetch)
28 TEST2(__sync_nand_and_fetch)
29
30 TEST2(__sync_lock_test_and_set)
31
32 #define TEST3(TYPE) \
33 void t_##TYPE##__sync_val_compare_and_swap(TYPE *p) \
34 { \
35 __typeof(__sync_val_compare_and_swap(p, 1, 2)) *pp; \
36 pp = p; \
37 }
38
39 TEST3(int)
40 TEST3(long)