aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pragma-init-fini.c
blob: 4013b8dd094b683c5c2c82c04028301abbab84cc (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Tests for #pragma init and #pragma fini.  */

/* { dg-do run { target *-*-solaris2.* } } */

extern void abort ();

#pragma init		/* { dg-warning "malformed" } */
#pragma init ()		/* { dg-warning "malformed" } */
#pragma init init_func	/* { dg-warning "malformed" } */

#pragma fini		/* { dg-warning "malformed" } */
#pragma fini ()		/* { dg-warning "malformed" } */
#pragma fini fini_func	/* { dg-warning "malformed" } */

#pragma init (init_func, init_static_func)

int glob_1, glob_2;

void init_func (void)
{
  glob_1 = 1;
}

static void init_static_func (void)
{
  glob_2 = 2;
}

#pragma fini (fini_func, fini_static_func)

void fini_func (void)
{

}

static void fini_static_func (void)
{

}

int main()
{
  if (glob_1 != 1)
    abort ();

  if (glob_2 != 2)
    abort ();

  return 0;
}