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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pragma-init-fini.c] - Rev 801

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

/* Tests for #pragma init and #pragma fini.  */
 
/* { dg-do run { target *-*-solaris2.* } } */
/* { dg-skip-if "no .pushsection/.popsection" { i?86-*-solaris2.8 && { ! gas } } } */
 
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;
}
 

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

powered by: WebSVN 2.1.0

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