summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pragma-diag-1.c
blob: b6d294d9ab5de5929917f9a911b149bce14e718f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { 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" } */
}