Ping: Re: pragma diagnostic push/pop
DJ Delorie
dj@redhat.com
Tue Jun 22 00:07:00 GMT 2010
The test case is probably an ideal example (minus dejagnuisms). I assume the
usual usage will be "push; reclassify; some code; pop".
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -O2" } */
/* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
main()
{
int a;
int b;
int c;
int d;
#pragma GCC diagnostic error "-Wuninitialized"
foo(a); /* { dg-error "uninitialized" } */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
foo(b);
#pragma GCC diagnostic pop
foo(c); /* { dg-error "uninitialized" } */
#pragma GCC diagnostic pop
foo(d); /* { dg-warning "uninitialized" } */
}
More information about the Gcc-patches
mailing list