# HG changeset patch # User Nick Wellnhofer <wellnhofer@aevum.de> # Date 1659050886 -7200 # Fri Jul 29 01:28:06 2022 +0200 # Node ID 124f4c3563bf2a5e5462b9789ae7c10f158fbe61 # Parent 86ed8ac0e9968ac4f76c43f94316ebf930fa26bd Simplify xsltexports.h and exsltexports.h Port the following libxml2 commit to libxslt: https://gitlab.gnome.org/GNOME/libxml2/-/commit/acdc2ff3607fe003c2febc25f28954146b3c1636 Fixes #71. diff --git a/libexslt/exsltexports.h b/libexslt/exsltexports.h --- a/libexslt/exsltexports.h +++ b/libexslt/exsltexports.h @@ -2,133 +2,56 @@ * Summary: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatkovic <igor@zlatkovic.com> */ #ifndef __EXSLT_EXPORTS_H__ #define __EXSLT_EXPORTS_H__ -/** - * EXSLTPUBFUN, EXSLTPUBVAR, EXSLTCALL - * - * 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 LIBEXSLT_STATIC + #define EXSLTPUBLIC +#elif defined(IN_LIBEXSLT) + #define EXSLTPUBLIC __declspec(dllexport) +#else + #define EXSLTPUBLIC __declspec(dllimport) +#endif + +#define EXSLTCALL __cdecl + +/** DOC_ENABLE */ +#else /* not Windows */ /** - * EXSLTPUBFUN: + * EXSLTPUBLIC: * - * Macros which declare an exportable function + * Macro which declares a public symbol */ -#define EXSLTPUBFUN -/** - * EXSLTPUBVAR: - * - * Macros which declare an exportable variable - */ -#define EXSLTPUBVAR extern +#define EXSLTPUBLIC + /** * EXSLTCALL: * - * Macros which declare the called convention for exported functions + * Macro which declares the calling convention for exported functions */ #define EXSLTCALL -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef EXSLTPUBFUN - #undef EXSLTPUBVAR - #undef EXSLTCALL - #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) - #define EXSLTPUBFUN __declspec(dllexport) - #define EXSLTPUBVAR __declspec(dllexport) - #else - #define EXSLTPUBFUN - #if !defined(LIBEXSLT_STATIC) - #define EXSLTPUBVAR __declspec(dllimport) extern - #else - #define EXSLTPUBVAR extern - #endif - #endif - #define EXSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif +#endif /* platform switch */ -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef EXSLTPUBFUN - #undef EXSLTPUBVAR - #undef EXSLTCALL - #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) - #define EXSLTPUBFUN __declspec(dllexport) - #define EXSLTPUBVAR __declspec(dllexport) extern - #else - #define EXSLTPUBFUN - #if !defined(LIBEXSLT_STATIC) - #define EXSLTPUBVAR __declspec(dllimport) extern - #else - #define EXSLTPUBVAR extern - #endif - #endif - #define EXSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif +/* + * EXSLTPUBFUN: + * + * Macro which declares an exportable function + */ +#define EXSLTPUBFUN EXSLTPUBLIC -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef EXSLTPUBFUN - #undef EXSLTPUBVAR - #undef EXSLTCALL -/* - #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) -*/ - #if !defined(LIBEXSLT_STATIC) - #define EXSLTPUBFUN __declspec(dllexport) - #define EXSLTPUBVAR __declspec(dllexport) extern - #else - #define EXSLTPUBFUN - #if !defined(LIBEXSLT_STATIC) - #define EXSLTPUBVAR __declspec(dllimport) extern - #else - #define EXSLTPUBVAR extern - #endif - #endif - #define EXSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform (does not define _WIN32), GNU compiler */ -#if defined(__CYGWIN__) - #undef EXSLTPUBFUN - #undef EXSLTPUBVAR - #undef EXSLTCALL - #if defined(IN_LIBEXSLT) && !defined(LIBEXSLT_STATIC) - #define EXSLTPUBFUN __declspec(dllexport) - #define EXSLTPUBVAR __declspec(dllexport) - #else - #define EXSLTPUBFUN - #if !defined(LIBEXSLT_STATIC) - #define EXSLTPUBVAR __declspec(dllimport) extern - #else - #define EXSLTPUBVAR extern - #endif - #endif - #define EXSLTCALL __cdecl -#endif +/** + * EXSLTPUBVAR: + * + * Macro which declares an exportable variable + */ +#define EXSLTPUBVAR EXSLTPUBLIC extern /* Compatibility */ #if !defined(LIBEXSLT_PUBLIC) diff --git a/libxslt/xsltexports.h b/libxslt/xsltexports.h --- a/libxslt/xsltexports.h +++ b/libxslt/xsltexports.h @@ -3,134 +3,56 @@ * Description: macros for marking symbols as exportable/importable. * * Copy: See Copyright for the status of this software. - * - * Author: Igor Zlatkovic <igor@zlatkovic.com> */ #ifndef __XSLT_EXPORTS_H__ #define __XSLT_EXPORTS_H__ -/** - * XSLTPUBFUN: - * XSLTPUBFUN, XSLTPUBVAR, XSLTCALL - * - * 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 LIBXSLT_STATIC + #define XSLTPUBLIC +#elif defined(IN_LIBXSLT) + #define XSLTPUBLIC __declspec(dllexport) +#else + #define XSLTPUBLIC __declspec(dllimport) +#endif + +#define XSLTCALL __cdecl + +/** DOC_ENABLE */ +#else /* not Windows */ /** - * XSLTPUBFUN: + * XSLTPUBLIC: * - * Macros which declare an exportable function + * Macro which declares a public symbol */ -#define XSLTPUBFUN -/** - * XSLTPUBVAR: - * - * Macros which declare an exportable variable - */ -#define XSLTPUBVAR extern +#define XSLTPUBLIC + /** * XSLTCALL: * - * Macros which declare the called convention for exported functions + * Macro which declares the calling convention for exported functions */ #define XSLTCALL -/** DOC_DISABLE */ - -/* Windows platform with MS compiler */ -#if defined(_WIN32) && defined(_MSC_VER) - #undef XSLTPUBFUN - #undef XSLTPUBVAR - #undef XSLTCALL - #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) - #define XSLTPUBFUN __declspec(dllexport) - #define XSLTPUBVAR __declspec(dllexport) - #else - #define XSLTPUBFUN - #if !defined(LIBXSLT_STATIC) - #define XSLTPUBVAR __declspec(dllimport) extern - #else - #define XSLTPUBVAR extern - #endif - #endif - #define XSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif +#endif /* platform switch */ -/* Windows platform with Borland compiler */ -#if defined(_WIN32) && defined(__BORLANDC__) - #undef XSLTPUBFUN - #undef XSLTPUBVAR - #undef XSLTCALL - #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) - #define XSLTPUBFUN __declspec(dllexport) - #define XSLTPUBVAR __declspec(dllexport) extern - #else - #define XSLTPUBFUN - #if !defined(LIBXSLT_STATIC) - #define XSLTPUBVAR __declspec(dllimport) extern - #else - #define XSLTPUBVAR extern - #endif - #endif - #define XSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif +/* + * XSLTPUBFUN: + * + * Macro which declares an exportable function + */ +#define XSLTPUBFUN XSLTPUBLIC -/* Windows platform with GNU compiler (Mingw) */ -#if defined(_WIN32) && defined(__MINGW32__) - #undef XSLTPUBFUN - #undef XSLTPUBVAR - #undef XSLTCALL -/* - #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) -*/ - #if !defined(LIBXSLT_STATIC) - #define XSLTPUBFUN __declspec(dllexport) - #define XSLTPUBVAR __declspec(dllexport) extern - #else - #define XSLTPUBFUN - #if !defined(LIBXSLT_STATIC) - #define XSLTPUBVAR __declspec(dllimport) extern - #else - #define XSLTPUBVAR extern - #endif - #endif - #define XSLTCALL __cdecl - #if !defined _REENTRANT - #define _REENTRANT - #endif -#endif - -/* Cygwin platform (does not define _WIN32), GNU compiler */ -#if defined(__CYGWIN__) - #undef XSLTPUBFUN - #undef XSLTPUBVAR - #undef XSLTCALL - #if defined(IN_LIBXSLT) && !defined(LIBXSLT_STATIC) - #define XSLTPUBFUN __declspec(dllexport) - #define XSLTPUBVAR __declspec(dllexport) - #else - #define XSLTPUBFUN - #if !defined(LIBXSLT_STATIC) - #define XSLTPUBVAR __declspec(dllimport) extern - #else - #define XSLTPUBVAR extern - #endif - #endif - #define XSLTCALL __cdecl -#endif +/** + * XSLTPUBVAR: + * + * Macro which declares an exportable variable + */ +#define XSLTPUBVAR XSLTPUBLIC extern /* Compatibility */ #if !defined(LIBXSLT_PUBLIC)