OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [pragma-init-fini.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Tests for #pragma init and #pragma fini.  */
2
 
3
/* { dg-do run { target *-*-solaris2.* } } */
4
 
5
extern void abort ();
6
 
7
#pragma init            /* { dg-error "malformed" } */
8
#pragma init ()         /* { dg-error "malformed" } */
9
#pragma init init_func  /* { dg-error "malformed" } */
10
 
11
#pragma fini            /* { dg-error "malformed" } */
12
#pragma fini ()         /* { dg-error "malformed" } */
13
#pragma fini fini_func  /* { dg-error "malformed" } */
14
 
15
#pragma init (init_func, init_static_func)
16
 
17
int glob_1, glob_2;
18
 
19
void init_func (void)
20
{
21
  glob_1 = 1;
22
}
23
 
24
static void init_static_func (void)
25
{
26
  glob_2 = 2;
27
}
28
 
29
#pragma fini (fini_func, fini_static_func)
30
 
31
void fini_func (void)
32
{
33
 
34
}
35
 
36
static void fini_static_func (void)
37
{
38
 
39
}
40
 
41
int main()
42
{
43
  if (glob_1 != 1)
44
    abort ();
45
 
46
  if (glob_2 != 2)
47
    abort ();
48
 
49
  return 0;
50
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.