xref: /aosp_15_r20/external/cronet/third_party/libxml/src/include/libxml/xmlexports.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 __GNUC__ * 100 + __GNUC_MINOR__ >= 207
45   #define ATTRIBUTE_UNUSED __attribute__((unused))
46 #else
47   #define ATTRIBUTE_UNUSED
48 #endif
49 
50 #if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)
51   #define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
52 #else
53   #define LIBXML_ATTR_ALLOC_SIZE(x)
54 #endif
55 
56 #if __GNUC__ * 100 + __GNUC_MINOR__ >= 303
57   #define LIBXML_ATTR_FORMAT(fmt,args) \
58     __attribute__((__format__(__printf__,fmt,args)))
59 #else
60   #define LIBXML_ATTR_FORMAT(fmt,args)
61 #endif
62 
63 #ifndef XML_DEPRECATED
64   #if defined(IN_LIBXML)
65     #define XML_DEPRECATED
66   #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
67     #define XML_DEPRECATED __attribute__((deprecated))
68   #elif _MSC_VER >= 1400
69     /* Available since Visual Studio 2005 */
70     #define XML_DEPRECATED __declspec(deprecated)
71   #else
72     #define XML_DEPRECATED
73   #endif
74 #endif
75 
76 /*
77  * Warnings pragmas, should be moved from public headers
78  */
79 
80 #if defined(__LCC__)
81 
82   #define XML_IGNORE_FPTR_CAST_WARNINGS
83   #define XML_POP_WARNINGS \
84     _Pragma("diag_default 1215")
85 
86 #elif defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
87 
88   #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800)
89     #define XML_IGNORE_FPTR_CAST_WARNINGS \
90       _Pragma("GCC diagnostic push") \
91       _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
92       _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
93   #else
94     #define XML_IGNORE_FPTR_CAST_WARNINGS \
95       _Pragma("GCC diagnostic push") \
96       _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
97   #endif
98   #define XML_POP_WARNINGS \
99     _Pragma("GCC diagnostic pop")
100 
101 #elif _MSC_VER >= 1400
102 
103   #define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
104   #define XML_POP_WARNINGS __pragma(warning(pop))
105 
106 #else
107 
108   #define XML_IGNORE_FPTR_CAST_WARNINGS
109   #define XML_POP_WARNINGS
110 
111 #endif
112 
113 /*
114  * Accessors for globals
115  */
116 
117 #define XML_NO_ATTR
118 
119 #ifdef LIBXML_THREAD_ENABLED
120   #define XML_DECLARE_GLOBAL(name, type, attrs) \
121     attrs XMLPUBFUN type *__##name(void);
122   #define XML_GLOBAL_MACRO(name) (*__##name())
123 #else
124   #define XML_DECLARE_GLOBAL(name, type, attrs) \
125     attrs XMLPUBVAR type name;
126 #endif
127 
128 /*
129  * Originally declared in xmlversion.h which is generated
130  */
131 XMLPUBFUN void xmlCheckVersion(int version);
132 
133 #endif /* __XML_EXPORTS_H__ */
134 
135 
136