xref: /aosp_15_r20/external/libxml2/include/libxml/xmlexports.h (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1 /*
2  * Summary: macros for marking symbols as exportable/importable.
3  * Description: macros for marking symbols as exportable/importable.
4  *
5  * Copy: See Copyright for the status of this software.
6  */
7 
8 #ifndef __XML_EXPORTS_H__
9 #define __XML_EXPORTS_H__
10 
11 /** DOC_DISABLE */
12 
13 /*
14  * Symbol visibility
15  */
16 
17 #if defined(_WIN32) || defined(__CYGWIN__)
18   #ifdef LIBXML_STATIC
19     #define XMLPUBLIC
20   #elif defined(IN_LIBXML)
21     #define XMLPUBLIC __declspec(dllexport)
22   #else
23     #define XMLPUBLIC __declspec(dllimport)
24   #endif
25 #else /* not Windows */
26   #define XMLPUBLIC
27 #endif /* platform switch */
28 
29 #define XMLPUBFUN XMLPUBLIC
30 
31 #define XMLPUBVAR XMLPUBLIC extern
32 
33 /* Compatibility */
34 #define XMLCALL
35 #define XMLCDECL
36 #ifndef LIBXML_DLL_IMPORT
37   #define LIBXML_DLL_IMPORT XMLPUBVAR
38 #endif
39 
40 /*
41  * Attributes
42  */
43 
44 #if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)
45   #define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
46 #else
47   #define LIBXML_ATTR_ALLOC_SIZE(x)
48 #endif
49 
50 #if __GNUC__ * 100 + __GNUC_MINOR__ >= 303
51   #define LIBXML_ATTR_FORMAT(fmt,args) \
52     __attribute__((__format__(__printf__,fmt,args)))
53 #else
54   #define LIBXML_ATTR_FORMAT(fmt,args)
55 #endif
56 
57 #ifndef XML_DEPRECATED
58   #if defined(IN_LIBXML)
59     #define XML_DEPRECATED
60   #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
61     #define XML_DEPRECATED __attribute__((deprecated))
62   #elif defined(_MSC_VER) && _MSC_VER >= 1400
63     /* Available since Visual Studio 2005 */
64     #define XML_DEPRECATED __declspec(deprecated)
65   #else
66     #define XML_DEPRECATED
67   #endif
68 #endif
69 
70 #ifndef XML_DEPRECATED_MEMBER
71   #if defined(IN_LIBXML)
72     #define XML_DEPRECATED_MEMBER
73   #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
74     #define XML_DEPRECATED_MEMBER __attribute__((deprecated))
75   #else
76     #define XML_DEPRECATED_MEMBER
77   #endif
78 #endif
79 
80 /*
81  * Warnings pragmas, should be moved from public headers
82  */
83 
84 #if defined(__LCC__)
85 
86   #define XML_IGNORE_FPTR_CAST_WARNINGS
87   #define XML_POP_WARNINGS \
88     _Pragma("diag_default 1215")
89 
90 #elif defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
91 
92   #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800)
93     #define XML_IGNORE_FPTR_CAST_WARNINGS \
94       _Pragma("GCC diagnostic push") \
95       _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
96       _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
97   #else
98     #define XML_IGNORE_FPTR_CAST_WARNINGS \
99       _Pragma("GCC diagnostic push") \
100       _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
101   #endif
102   #define XML_POP_WARNINGS \
103     _Pragma("GCC diagnostic pop")
104 
105 #elif defined(_MSC_VER) && _MSC_VER >= 1400
106 
107   #define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
108   #define XML_POP_WARNINGS __pragma(warning(pop))
109 
110 #else
111 
112   #define XML_IGNORE_FPTR_CAST_WARNINGS
113   #define XML_POP_WARNINGS
114 
115 #endif
116 
117 /*
118  * Accessors for globals
119  */
120 
121 #define XML_NO_ATTR
122 
123 #ifdef LIBXML_THREAD_ENABLED
124   #define XML_DECLARE_GLOBAL(name, type, attrs) \
125     attrs XMLPUBFUN type *__##name(void);
126   #define XML_GLOBAL_MACRO(name) (*__##name())
127 #else
128   #define XML_DECLARE_GLOBAL(name, type, attrs) \
129     attrs XMLPUBVAR type name;
130 #endif
131 
132 /*
133  * Originally declared in xmlversion.h which is generated
134  */
135 
136 #ifdef __cplusplus
137 extern "C" {
138 #endif
139 
140 XMLPUBFUN void xmlCheckVersion(int version);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* __XML_EXPORTS_H__ */
147 
148 
149