summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/cpp/pragma-diagnostic-1.c
blob: 3a2f9da1fceda2c56d8cf6cdb9a8b0d40ce3f2af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
  { dg-options "-Wuninitialized" }
  { dg-do compile }
*/

void f (unsigned);

#define CODE_WITH_WARNING \
  int a;		  \
  f (a)

#pragma GCC diagnostic ignored "-Wuninitialized"

void
g (void)
{
  CODE_WITH_WARNING;
}

#pragma GCC diagnostic push

#pragma GCC diagnostic error "-Wuninitialized"

void
h (void)
{
  CODE_WITH_WARNING;		/* { dg-error "uninitialized" } */
}

/*
  { dg-message "some warnings being treated as errors" "" {target *-*-*} 0 }
*/
OpenPOWER on IntegriCloud