summaryrefslogtreecommitdiff
path: root/support/valdiag/tests/declafterstmt.c
blob: 51ce7ca5ecc21f3cc74afc43bdf0a5425d9a2927 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
/* we are testing a C99 feature */
#pragma std_c99

/* we do not care about unreferenced variables */
#pragma disable_warning 85

#ifdef TEST1
#pragma std_c89
void test(void)
{
  int a = 0;
  a++;
  int b;
}               /* ERROR */ /* declaration after statement within this block */
#endif

#ifdef TEST2
void test(void)
{
  int a = 0;
  a++;
  int b;
}
#endif

#ifdef TEST3
void test(void)
{
  int a = 0;    /* ERROR */ /* previously defined here */
  a++;
  int a;        /* ERROR */ /* duplicate symbol */
}
#endif

#ifdef TEST4
void test(void)
{
  int a = 0;
  a++;
  int b;
  {
    int a;
  }
}
#endif