xmlexports.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. #ifndef __XML_EXPORTS_H__
  8. #define __XML_EXPORTS_H__
  9. /** DOC_DISABLE */
  10. /*
  11. * Symbol visibility
  12. */
  13. #if defined(_WIN32) || defined(__CYGWIN__)
  14. #ifdef LIBXML_STATIC
  15. #define XMLPUBLIC
  16. #elif defined(IN_LIBXML)
  17. #define XMLPUBLIC __declspec(dllexport)
  18. #else
  19. #define XMLPUBLIC __declspec(dllimport)
  20. #endif
  21. #else /* not Windows */
  22. #define XMLPUBLIC
  23. #endif /* platform switch */
  24. #define XMLPUBFUN XMLPUBLIC
  25. #define XMLPUBVAR XMLPUBLIC extern
  26. /* Compatibility */
  27. #define XMLCALL
  28. #define XMLCDECL
  29. #ifndef LIBXML_DLL_IMPORT
  30. #define LIBXML_DLL_IMPORT XMLPUBVAR
  31. #endif
  32. /*
  33. * Attributes
  34. */
  35. #ifndef ATTRIBUTE_UNUSED
  36. #if __GNUC__ * 100 + __GNUC_MINOR__ >= 207 || defined(__clang__)
  37. #define ATTRIBUTE_UNUSED __attribute__((unused))
  38. #else
  39. #define ATTRIBUTE_UNUSED
  40. #endif
  41. #endif
  42. #if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)
  43. #define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
  44. #else
  45. #define LIBXML_ATTR_ALLOC_SIZE(x)
  46. #endif
  47. #if __GNUC__ * 100 + __GNUC_MINOR__ >= 303
  48. #define LIBXML_ATTR_FORMAT(fmt,args) \
  49. __attribute__((__format__(__printf__,fmt,args)))
  50. #else
  51. #define LIBXML_ATTR_FORMAT(fmt,args)
  52. #endif
  53. #ifndef XML_DEPRECATED
  54. #if defined(IN_LIBXML)
  55. #define XML_DEPRECATED
  56. #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
  57. #define XML_DEPRECATED __attribute__((deprecated))
  58. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  59. /* Available since Visual Studio 2005 */
  60. #define XML_DEPRECATED __declspec(deprecated)
  61. #else
  62. #define XML_DEPRECATED
  63. #endif
  64. #endif
  65. /*
  66. * Warnings pragmas, should be moved from public headers
  67. */
  68. #if defined(__LCC__)
  69. #define XML_IGNORE_FPTR_CAST_WARNINGS
  70. #define XML_POP_WARNINGS \
  71. _Pragma("diag_default 1215")
  72. #elif defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
  73. #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800)
  74. #define XML_IGNORE_FPTR_CAST_WARNINGS \
  75. _Pragma("GCC diagnostic push") \
  76. _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
  77. _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
  78. #else
  79. #define XML_IGNORE_FPTR_CAST_WARNINGS \
  80. _Pragma("GCC diagnostic push") \
  81. _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
  82. #endif
  83. #define XML_POP_WARNINGS \
  84. _Pragma("GCC diagnostic pop")
  85. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  86. #define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
  87. #define XML_POP_WARNINGS __pragma(warning(pop))
  88. #else
  89. #define XML_IGNORE_FPTR_CAST_WARNINGS
  90. #define XML_POP_WARNINGS
  91. #endif
  92. /*
  93. * Accessors for globals
  94. */
  95. #define XML_NO_ATTR
  96. #ifdef LIBXML_THREAD_ENABLED
  97. #define XML_DECLARE_GLOBAL(name, type, attrs) \
  98. attrs XMLPUBFUN type *__##name(void);
  99. #define XML_GLOBAL_MACRO(name) (*__##name())
  100. #else
  101. #define XML_DECLARE_GLOBAL(name, type, attrs) \
  102. attrs XMLPUBVAR type name;
  103. #endif
  104. /*
  105. * Originally declared in xmlversion.h which is generated
  106. */
  107. #ifdef __cplusplus
  108. extern "C" {
  109. #endif
  110. XMLPUBFUN void xmlCheckVersion(int version);
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* __XML_EXPORTS_H__ */