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