mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-10-27 04:55:04 +03:00
Simplify xmlexports.h
All the compiler switches essentially set the same macros. The only exception was MSVC which omitted the "extern" keyword for exported variables. This in turn broke clang-cl. This commit rewrites and simplifies the whole header. Closes #163.
This commit is contained in:
parent
a218ff0ec0
commit
acdc2ff360
@ -3,43 +3,46 @@
|
||||
* Description: macros for marking symbols as exportable/importable.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Igor Zlatovic <igor@zlatkovic.com>
|
||||
*/
|
||||
|
||||
#ifndef __XML_EXPORTS_H__
|
||||
#define __XML_EXPORTS_H__
|
||||
|
||||
/**
|
||||
* XMLPUBFUN, XMLPUBVAR, XMLCALL
|
||||
*
|
||||
* Macros which declare an exportable function, an exportable variable and
|
||||
* the calling convention used for functions.
|
||||
*
|
||||
* Please use an extra block for every platform/compiler combination when
|
||||
* modifying this, rather than overlong #ifdef lines. This helps
|
||||
* readability as well as the fact that different compilers on the same
|
||||
* platform might need different definitions.
|
||||
*/
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
/** DOC_DISABLE */
|
||||
|
||||
#ifdef LIBXML_STATIC
|
||||
#define XMLPUBLIC
|
||||
#elif defined(IN_LIBXML)
|
||||
#define XMLPUBLIC __declspec(dllexport)
|
||||
#else
|
||||
#define XMLPUBLIC __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_FASTCALL)
|
||||
#define XMLCALL __fastcall
|
||||
#else
|
||||
#define XMLCALL __cdecl
|
||||
#endif
|
||||
#define XMLCDECL __cdecl
|
||||
|
||||
/** DOC_ENABLE */
|
||||
#else /* not Windows */
|
||||
|
||||
/**
|
||||
* XMLPUBFUN:
|
||||
* XMLPUBLIC:
|
||||
*
|
||||
* Macros which declare an exportable function
|
||||
* Macro which declares a public symbol
|
||||
*/
|
||||
#define XMLPUBFUN
|
||||
/**
|
||||
* XMLPUBVAR:
|
||||
*
|
||||
* Macros which declare an exportable variable
|
||||
*/
|
||||
#define XMLPUBVAR extern
|
||||
#define XMLPUBLIC
|
||||
|
||||
/**
|
||||
* XMLCALL:
|
||||
*
|
||||
* Macros which declare the called convention for exported functions
|
||||
* Macro which declares the calling convention for exported functions
|
||||
*/
|
||||
#define XMLCALL
|
||||
|
||||
/**
|
||||
* XMLCDECL:
|
||||
*
|
||||
@ -48,100 +51,21 @@
|
||||
*/
|
||||
#define XMLCDECL
|
||||
|
||||
/** DOC_DISABLE */
|
||||
#endif /* platform switch */
|
||||
|
||||
/* Windows platform with MS compiler */
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#undef XMLPUBFUN
|
||||
#undef XMLPUBVAR
|
||||
#undef XMLCALL
|
||||
#undef XMLCDECL
|
||||
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
|
||||
#define XMLPUBFUN __declspec(dllexport)
|
||||
#define XMLPUBVAR __declspec(dllexport)
|
||||
#else
|
||||
#define XMLPUBFUN
|
||||
#if !defined(LIBXML_STATIC)
|
||||
#define XMLPUBVAR __declspec(dllimport) extern
|
||||
#else
|
||||
#define XMLPUBVAR extern
|
||||
#endif
|
||||
#endif
|
||||
#if defined(LIBXML_FASTCALL)
|
||||
#define XMLCALL __fastcall
|
||||
#else
|
||||
#define XMLCALL __cdecl
|
||||
#endif
|
||||
#define XMLCDECL __cdecl
|
||||
#endif
|
||||
/*
|
||||
* XMLPUBFUN:
|
||||
*
|
||||
* Macro which declares an exportable function
|
||||
*/
|
||||
#define XMLPUBFUN XMLPUBLIC
|
||||
|
||||
/* Windows platform with Borland compiler */
|
||||
#if defined(_WIN32) && defined(__BORLANDC__)
|
||||
#undef XMLPUBFUN
|
||||
#undef XMLPUBVAR
|
||||
#undef XMLCALL
|
||||
#undef XMLCDECL
|
||||
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
|
||||
#define XMLPUBFUN __declspec(dllexport)
|
||||
#define XMLPUBVAR __declspec(dllexport) extern
|
||||
#else
|
||||
#define XMLPUBFUN
|
||||
#if !defined(LIBXML_STATIC)
|
||||
#define XMLPUBVAR __declspec(dllimport) extern
|
||||
#else
|
||||
#define XMLPUBVAR extern
|
||||
#endif
|
||||
#endif
|
||||
#define XMLCALL __cdecl
|
||||
#define XMLCDECL __cdecl
|
||||
#endif
|
||||
|
||||
/* Windows platform with GNU compiler (Mingw) */
|
||||
#if defined(_WIN32) && defined(__MINGW32__)
|
||||
#undef XMLPUBFUN
|
||||
#undef XMLPUBVAR
|
||||
#undef XMLCALL
|
||||
#undef XMLCDECL
|
||||
/*
|
||||
* if defined(IN_LIBXML) this raises problems on mingw with msys
|
||||
* _imp__xmlFree listed as missing. Try to workaround the problem
|
||||
* by also making that declaration when compiling client code.
|
||||
*/
|
||||
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
|
||||
#define XMLPUBFUN __declspec(dllexport)
|
||||
#define XMLPUBVAR __declspec(dllexport) extern
|
||||
#else
|
||||
#define XMLPUBFUN
|
||||
#if !defined(LIBXML_STATIC)
|
||||
#define XMLPUBVAR __declspec(dllimport) extern
|
||||
#else
|
||||
#define XMLPUBVAR extern
|
||||
#endif
|
||||
#endif
|
||||
#define XMLCALL __cdecl
|
||||
#define XMLCDECL __cdecl
|
||||
#endif
|
||||
|
||||
/* Cygwin platform (does not define _WIN32), GNU compiler */
|
||||
#if defined(__CYGWIN__)
|
||||
#undef XMLPUBFUN
|
||||
#undef XMLPUBVAR
|
||||
#undef XMLCALL
|
||||
#undef XMLCDECL
|
||||
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
|
||||
#define XMLPUBFUN __declspec(dllexport)
|
||||
#define XMLPUBVAR __declspec(dllexport)
|
||||
#else
|
||||
#define XMLPUBFUN
|
||||
#if !defined(LIBXML_STATIC)
|
||||
#define XMLPUBVAR __declspec(dllimport) extern
|
||||
#else
|
||||
#define XMLPUBVAR extern
|
||||
#endif
|
||||
#endif
|
||||
#define XMLCALL __cdecl
|
||||
#define XMLCDECL __cdecl
|
||||
#endif
|
||||
/**
|
||||
* XMLPUBVAR:
|
||||
*
|
||||
* Macro which declares an exportable variable
|
||||
*/
|
||||
#define XMLPUBVAR XMLPUBLIC extern
|
||||
|
||||
/* Compatibility */
|
||||
#if !defined(LIBXML_DLL_IMPORT)
|
||||
|
Loading…
Reference in New Issue
Block a user