* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / pr69126.c
blob52c96ebe18969780fccda4c3ee5a62acce123379
1 /* { dg-options "-Wunused-variable" } */
3 /* Verify that ignoring -Wunused-variable works, for various placements
4 of the variable and the _Pragma. */
6 /* Test 1: the _Pragma is in a macro, but the affected code isn't. */
8 #pragma GCC diagnostic push
10 #define MACRO_1 \
11 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
13 int test_1()
15 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
16 int x;
17 return 0;
19 #pragma GCC diagnostic pop
22 /* Test 2: neither the _Pragma nor the affected code are in a macro. */
24 #pragma GCC diagnostic push
25 int test_2()
27 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
28 int x;
29 return 0;
31 #pragma GCC diagnostic pop
34 /* Test 3: the _Pragma isn't in a macro, but the affected code is. */
36 #define MACRO_3 \
37 int x;
39 #pragma GCC diagnostic push
40 int test_3()
42 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
43 MACRO_3
44 return 0;
46 #pragma GCC diagnostic pop
49 /* Test 4: the _Pragma and the affected code are in different macros. */
51 #pragma GCC diagnostic push
52 #define MACRO_4A \
53 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
55 #define MACRO_4B \
56 int x;
58 int test_4()
60 MACRO_4A;
61 MACRO_4B
62 return 0;
64 #pragma GCC diagnostic pop
67 /* Test 5: both the _Pragma and the affected code are in the same macro. */
69 #pragma GCC diagnostic push
70 #define MACRO_5 \
71 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
72 int x;
74 int test_5()
76 MACRO_5;
77 return 0;
79 #pragma GCC diagnostic pop