Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-2.c

raw
1 /*
2 { dg-options "-Wuninitialized -ftrack-macro-expansion=2" }
3 { dg-do compile }
4 */
5
6 void f (unsigned);
7
8 #define CODE_WITH_WARNING \
9 int a; /* { dg-message "was declared here" } */ \
10 f (a) /* { dg-error "used uninitialized" } */
11
12 #pragma GCC diagnostic ignored "-Wuninitialized"
13
14 void
15 g (void)
16 {
17 /* No warning expected here since the #pragma is in effect. */
18 CODE_WITH_WARNING;
19 }
20
21 #pragma GCC diagnostic error "-Wuninitialized"
22
23 void
24 h (void)
25 {
26 CODE_WITH_WARNING; /* { dg-message "in expansion of macro 'CODE_WITH_WARNING'" } */
27 }
28
29 /* { dg-regexp {.*some warnings being treated as errors} } */