1
/* Trampoline accessor test */
4
* Copyright 1995-1999, 2002, 2005 Bruno Haible, <bruno@clisp.org>
6
* This is free software distributed under the GNU General Public Licence
7
* described in the file COPYING. Contact the author if you don't have this
8
* or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
15
#include "trampoline.h"
18
typedef int (*function)(...);
20
typedef int (*function)();
32
function cf = alloc_trampoline((function)&f, &variable, &data);
33
if (is_trampoline((void*)&main))
34
{ printf("is_trampoline(&main) returns true!\n"); exit(1); }
35
if (!is_trampoline((void*)cf))
36
{ printf("is_trampoline() returns false!\n"); exit(1); }
37
if (trampoline_address((void*)cf) != (function)&f)
38
{ printf("trampoline_address() doesn't work!\n"); exit(1); }
39
if (trampoline_variable((void*)cf) != &variable)
40
{ printf("trampoline_variable() doesn't work!\n"); exit(1); }
41
if (trampoline_data((void*)cf) != &data)
42
{ printf("trampoline_data() doesn't work!\n"); exit(1); }
43
printf("test2 passed.\n");