| 1 |
void __attribute__ ((noipa, noinline)) my_puts (const char *str) { } |
| 2 |
|
| 3 |
void __attribute__ ((noipa, noinline)) my_free (void *p) { } |
| 4 |
|
| 5 |
|
| 6 |
struct Node |
| 7 |
{ |
| 8 |
struct Node *child; |
| 9 |
}; |
| 10 |
|
| 11 |
struct Node space[2] = { }; |
| 12 |
|
| 13 |
struct Node * __attribute__ ((noipa, noinline)) my_malloc (int bytes) |
| 14 |
{ |
| 15 |
return &space[0]; |
| 16 |
} |
| 17 |
|
| 18 |
void |
| 19 |
walk (struct Node *module, int cleanup) |
| 20 |
{ |
| 21 |
if (module == 0) |
| 22 |
{ |
| 23 |
return; |
| 24 |
} |
| 25 |
if (!cleanup) |
| 26 |
{ |
| 27 |
my_puts ("No cleanup"); |
| 28 |
} |
| 29 |
walk (module->child, cleanup); |
| 30 |
if (cleanup) |
| 31 |
{ |
| 32 |
my_free (module); |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
int |
| 37 |
main () |
| 38 |
{ |
| 39 |
struct Node *node = my_malloc (sizeof (struct Node)); |
| 40 |
node->child = 0; |
| 41 |
walk (node, 1); |
| 42 |
} |