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
11 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
15 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
19 #pragma GCC diagnostic pop
22 /* Test 2: neither the _Pragma nor the affected code are in a macro. */
24 #pragma GCC diagnostic push
27 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
31 #pragma GCC diagnostic pop
34 /* Test 3: the _Pragma isn't in a macro, but the affected code is. */
39 #pragma GCC diagnostic push
42 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
46 #pragma GCC diagnostic pop
49 /* Test 4: the _Pragma and the affected code are in different macros. */
51 #pragma GCC diagnostic push
53 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
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
71 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
79 #pragma GCC diagnostic pop