URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 338 |
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
typedef void (*listener_fun)(
|
typedef void (*listener_fun)(
|
int a,
|
int a,
|
int b,
|
int b,
|
int c);
|
int c);
|
|
|
struct data_t
|
struct data_t
|
{
|
{
|
int a;
|
int a;
|
|
|
listener_fun listener;
|
listener_fun listener;
|
|
|
int b;
|
int b;
|
int c;
|
int c;
|
int d;
|
int d;
|
};
|
};
|
|
|
extern void abort(void);
|
extern void abort(void);
|
void function_calling_listener (struct data_t data);
|
void function_calling_listener (struct data_t data);
|
|
|
void function_calling_listener (struct data_t data)
|
void function_calling_listener (struct data_t data)
|
{
|
{
|
data.listener(data.a, data.c, data.d);
|
data.listener(data.a, data.c, data.d);
|
}
|
}
|
|
|
void my_listener(int a, int b, int c)
|
void my_listener(int a, int b, int c)
|
{
|
{
|
if (a != 42 || b != 44 || c != 45)
|
if (a != 42 || b != 44 || c != 45)
|
abort ();
|
abort ();
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
struct data_t d;
|
struct data_t d;
|
d.a = 42;
|
d.a = 42;
|
d.b = 43;
|
d.b = 43;
|
d.c = 44;
|
d.c = 44;
|
d.d = 45;
|
d.d = 45;
|
d.listener = my_listener;
|
d.listener = my_listener;
|
function_calling_listener (d);
|
function_calling_listener (d);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.