Imt.Base C++ API V4.1.1.0
Loading...
Searching...
No Matches
cdefs-compat.h
Go to the documentation of this file.
1#ifndef _CDEFS_COMPAT_H_
2#define _CDEFS_COMPAT_H_
3
4#if !defined(__BEGIN_DECLS)
5#if defined(__cplusplus)
6#define __BEGIN_DECLS extern "C" {
7#define __END_DECLS }
8#else
9#define __BEGIN_DECLS
10#define __END_DECLS
11#endif
12#endif /* !defined(__BEGIN_DECLS) */
13
14#if defined(__ICCARM__)
15#define __volatile volatile
16
17
18#elif defined(__GNUC__)
19#if defined(__strong_alias) && defined(__NetBSD__)
20#define openlibm_strong_reference(sym,alias) __strong_alias(alias,sym)
21#elif defined(__strong_reference)
22#define openlibm_strong_reference(sym,alias) __strong_reference(sym,alias)
23#else
24#ifdef __APPLE__
25#define openlibm_strong_reference(sym,aliassym) openlibm_weak_reference(sym,aliassym)
26#else
27#define openlibm_strong_reference(sym,aliassym) \
28 OLM_DLLEXPORT extern __typeof (aliassym) aliassym __attribute__ ((__alias__ (#sym)));
29#endif /* __APPLE__ */
30#endif /* __strong_reference */
31
32#ifdef __wasm__
33#define openlibm_weak_reference(sym,alias) openlibm_strong_reference(sym,alias)
34#elif defined(__weak_alias) && defined(__NetBSD__)
35#define openlibm_weak_reference(sym,alias) __weak_alias(alias,sym)
36#elif defined(__weak_reference)
37#define openlibm_weak_reference(sym,alias) __weak_reference(sym,alias)
38#else
39#ifdef __ELF__
40#ifdef __STDC__
41#define openlibm_weak_reference(sym,alias) \
42 __asm__(".weak " #alias); \
43 __asm__(".equ " #alias ", " #sym)
44#ifdef __warn_references
45#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
46#else
47#define openlibm_warn_references(sym,msg) \
48 __asm__(".section .gnu.warning." #sym); \
49 __asm__(".asciz \"" msg "\""); \
50 __asm__(".previous")
51#endif /* __warn_references */
52#else
53#define openlibm_weak_reference(sym,alias) \
54 __asm__(".weak alias"); \
55 __asm__(".equ alias, sym")
56#ifdef __warn_references
57#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
58#else
59#define openlibm_warn_references(sym,msg) \
60 __asm__(".section .gnu.warning.sym"); \
61 __asm__(".asciz \"msg\""); \
62 __asm__(".previous")
63#endif /* __warn_references */
64#endif /* __STDC__ */
65#elif defined(__clang__) /* CLANG */
66#if defined(_WIN32) && defined(_X86_)
67#define openlibm_asm_symbol_prefix "_"
68#else
69#define openlibm_asm_symbol_prefix ""
70#endif
71#ifdef __STDC__
72#define openlibm_weak_reference(sym,alias) \
73 __asm__(".weak_reference " openlibm_asm_symbol_prefix #alias); \
74 __asm__(".set " openlibm_asm_symbol_prefix #alias ", " openlibm_asm_symbol_prefix #sym)
75#else
76#define openlibm_weak_reference(sym,alias) \
77 __asm__(".weak_reference openlibm_asm_symbol_prefix/**/alias");\
78 __asm__(".set openlibm_asm_symbol_prefix/**/alias, openlibm_asm_symbol_prefix/**/sym")
79#endif
80#else /* !__ELF__ */
81#ifdef __STDC__
82#define openlibm_weak_reference(sym,alias) \
83 __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
84 __asm__(".stabs \"_" #sym "\",1,0,0,0")
85#ifdef __warn_references
86#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
87#else
88#define openlibm_warn_references(sym,msg) \
89 __asm__(".stabs \"" msg "\",30,0,0,0"); \
90 __asm__(".stabs \"_" #sym "\",1,0,0,0")
91#endif /* __warn_references */
92#else
93#define openlibm_weak_reference(sym,alias) \
94 __asm__(".stabs \"_/**/alias\",11,0,0,0"); \
95 __asm__(".stabs \"_/**/sym\",1,0,0,0")
96#ifdef __warn_references
97#define openlibm_warn_references(sym,msg) __warn_references(sym,msg)
98#else
99#define openlibm_warn_references(sym,msg) \
100 __asm__(".stabs msg,30,0,0,0"); \
101 __asm__(".stabs \"_/**/sym\",1,0,0,0")
102#endif /* __warn_references */
103#endif /* __STDC__ */
104#endif /* __ELF__ */
105#endif /* __weak_reference */
106#endif /* __GNUC__ */
107
108
109#endif /* _CDEFS_COMPAT_H_ */