This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ping: Re: pragma diagnostic push/pop


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" } */
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]