1 /* Test for _Atomic in C11. Test of valid assignment cases for
3 /* { dg-do compile } */
4 /* { dg-options "-std=c11 -pedantic-errors" } */
6 #define TEST_ASSIGN(TYPE1, OP, TYPE2) \
11 _Atomic TYPE2 c = 0; \
17 #define TEST_ASSIGN_ARITHR(TYPE1, OP) \
20 TEST_ASSIGN (TYPE1, OP, _Bool); \
21 TEST_ASSIGN (TYPE1, OP, char); \
22 TEST_ASSIGN (TYPE1, OP, signed char); \
23 TEST_ASSIGN (TYPE1, OP, unsigned char); \
24 TEST_ASSIGN (TYPE1, OP, signed short); \
25 TEST_ASSIGN (TYPE1, OP, unsigned short); \
26 TEST_ASSIGN (TYPE1, OP, signed int); \
27 TEST_ASSIGN (TYPE1, OP, unsigned int); \
28 TEST_ASSIGN (TYPE1, OP, signed long); \
29 TEST_ASSIGN (TYPE1, OP, unsigned long); \
30 TEST_ASSIGN (TYPE1, OP, signed long long); \
31 TEST_ASSIGN (TYPE1, OP, unsigned long long); \
32 TEST_ASSIGN (TYPE1, OP, float); \
33 TEST_ASSIGN (TYPE1, OP, double); \
34 TEST_ASSIGN (TYPE1, OP, long double); \
35 TEST_ASSIGN (TYPE1, OP, _Complex float); \
36 TEST_ASSIGN (TYPE1, OP, _Complex double); \
37 TEST_ASSIGN (TYPE1, OP, _Complex long double); \
41 #define TEST_ASSIGN_ARITHBOTH(OP) \
44 TEST_ASSIGN_ARITHR (_Bool, OP); \
45 TEST_ASSIGN_ARITHR (char, OP); \
46 TEST_ASSIGN_ARITHR (signed char, OP); \
47 TEST_ASSIGN_ARITHR (unsigned char, OP); \
48 TEST_ASSIGN_ARITHR (signed short, OP); \
49 TEST_ASSIGN_ARITHR (unsigned short, OP); \
50 TEST_ASSIGN_ARITHR (signed int, OP); \
51 TEST_ASSIGN_ARITHR (unsigned int, OP); \
52 TEST_ASSIGN_ARITHR (signed long, OP); \
53 TEST_ASSIGN_ARITHR (unsigned long, OP); \
54 TEST_ASSIGN_ARITHR (signed long long, OP); \
55 TEST_ASSIGN_ARITHR (unsigned long long, OP); \
56 TEST_ASSIGN_ARITHR (float, OP); \
57 TEST_ASSIGN_ARITHR (double, OP); \
58 TEST_ASSIGN_ARITHR (long double, OP); \
59 TEST_ASSIGN_ARITHR (_Complex float, OP); \
60 TEST_ASSIGN_ARITHR (_Complex double, OP); \
61 TEST_ASSIGN_ARITHR (_Complex long double, OP); \
65 #define TEST_ASSIGN_INTR(TYPE1, OP) \
68 TEST_ASSIGN (TYPE1, OP, _Bool); \
69 TEST_ASSIGN (TYPE1, OP, char); \
70 TEST_ASSIGN (TYPE1, OP, signed char); \
71 TEST_ASSIGN (TYPE1, OP, unsigned char); \
72 TEST_ASSIGN (TYPE1, OP, signed short); \
73 TEST_ASSIGN (TYPE1, OP, unsigned short); \
74 TEST_ASSIGN (TYPE1, OP, signed int); \
75 TEST_ASSIGN (TYPE1, OP, unsigned int); \
76 TEST_ASSIGN (TYPE1, OP, signed long); \
77 TEST_ASSIGN (TYPE1, OP, unsigned long); \
78 TEST_ASSIGN (TYPE1, OP, signed long long); \
79 TEST_ASSIGN (TYPE1, OP, unsigned long long); \
83 #define TEST_ASSIGN_INTBOTH(OP) \
86 TEST_ASSIGN_INTR (_Bool, OP); \
87 TEST_ASSIGN_INTR (char, OP); \
88 TEST_ASSIGN_INTR (signed char, OP); \
89 TEST_ASSIGN_INTR (unsigned char, OP); \
90 TEST_ASSIGN_INTR (signed short, OP); \
91 TEST_ASSIGN_INTR (unsigned short, OP); \
92 TEST_ASSIGN_INTR (signed int, OP); \
93 TEST_ASSIGN_INTR (unsigned int, OP); \
94 TEST_ASSIGN_INTR (signed long, OP); \
95 TEST_ASSIGN_INTR (unsigned long, OP); \
96 TEST_ASSIGN_INTR (signed long long, OP); \
97 TEST_ASSIGN_INTR (unsigned long long, OP); \
104 TEST_ASSIGN_ARITHBOTH (=);
110 TEST_ASSIGN_ARITHBOTH (*=);
116 TEST_ASSIGN_ARITHBOTH (/=);
122 TEST_ASSIGN_INTBOTH (%=);
128 TEST_ASSIGN_ARITHBOTH (+=);
134 TEST_ASSIGN_ARITHBOTH (-=);
140 TEST_ASSIGN_INTBOTH (<<=);
146 TEST_ASSIGN_INTBOTH (>>=);
152 TEST_ASSIGN_INTBOTH (&=);
158 TEST_ASSIGN_INTBOTH (^=);
164 TEST_ASSIGN_INTBOTH (|=);