Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
windows
fun_present_check.cpp
Go to the documentation of this file.
1
2
24
extern
"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
32
union
{
33
funptr_t
pf
;
34
unsigned
long
ul
;
35
}
funptri
;
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
51
namespace
std
{ }
52
using namespace
std
;
53
54
# endif
// NONAMESPACE
55
56
int
main
(
int
argc,
char
**)
57
{
58
// with gcc, prevent intrinsics from causing false positives
59
60
# if TAKE_ADDR
61
62
funptri
.pf = (
funptr_t
)&
FUNNAME
;
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
85
extern
"C"
void
FUNNAME
();
86
87
int
main
(
int
argc,
char
**)
88
{
89
funptri
.pf = (
funptr_t
)&
FUNNAME
;
90
91
return
(argc < 1 ? !
funptri
.ul : !!
funptri
.ul) + 0;
92
}
93
94
#endif
// CHECK_DECL
95
96
FUN
#define FUN(result, name, arg_list)
main
#define main
Definition
BAD_ALLOC_COPY_CTOR.cpp:32
funptri
union @18 funptri
funptr_t
void(* funptr_t)()
Definition
fun_present_check.cpp:26
ul
unsigned long ul
Definition
fun_present_check.cpp:34
FUNNAME
void FUNNAME()
pf
funptr_t pf
Definition
fun_present_check.cpp:33
std
Definition
json.h:5363
Generated by
1.9.8