PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / pragma-diag-1.c
blobd0bb0d6f66ce441003381475bd86a49304996b6b
1 /* { dg-do compile } */
2 /* { dg-options "-Wuninitialized -O2" } */
3 /* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
5 void foo (int);
7 int
8 main()
10 int a;
11 int b;
12 int c;
13 int d;
15 #pragma GCC diagnostic error "-Wuninitialized"
16 foo(a); /* { dg-error "uninitialized" } */
17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wuninitialized"
19 foo(b);
20 #pragma GCC diagnostic pop
21 foo(c); /* { dg-error "uninitialized" } */
22 #pragma GCC diagnostic pop
23 foo(d); /* { dg-warning "uninitialized" } */