Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
fun_present_check.cpp
Go to the documentation of this file.
1
2
24extern "C"
25{
26 typedef void (*funptr_t)();
27}
28
29// take the address of the function in a way
30// that foils even clever optimizers
31
32union {
34 unsigned long ul;
36
37#ifdef CHECK_DECL
38
39# if defined (__linux__) && defined (__GNUG__) && __GNUG__ < 3
40 // prevent empty exception specifications from triggering
41 // gcc 2.9x -fhonor-std link errors looking for std::terminate()
42# include <features.h>
43# undef __THROW
44# define __THROW
45# endif // gcc < 3 on Linux
46
47# include HDRNAME
48
49# ifndef NONAMESPACE
50
51namespace std { }
52using namespace std;
53
54# endif // NONAMESPACE
55
56int main (int argc, char**)
57{
58 // with gcc, prevent intrinsics from causing false positives
59
60# if TAKE_ADDR
61
63
64 return (argc < 1 ? !funptri.ul : !!funptri.ul) + 0;
65
66# else // if !TAKE_ADDR
67
68 // disable warnings about an unused variable
69 (void)&argc;
70
71 // call the function using the supplied arguments
72 #ifdef FUN_PARAMS
73 FUN_PARAMS;
74 #endif
75 (void)FUN;
76
77 return 0;
78
79# endif // TAKE_ADDR
80
81}
82
83#else // if !defined (CHECK_DECL)
84
85extern "C" void FUNNAME ();
86
87int main (int argc, char**)
88{
90
91 return (argc < 1 ? !funptri.ul : !!funptri.ul) + 0;
92}
93
94#endif // CHECK_DECL
95
96
#define FUN(result, name, arg_list)
#define main
union @18 funptri
void(* funptr_t)()
unsigned long ul
void FUNNAME()
funptr_t pf
Definition json.h:5363