[libxslt] Simplify xsltexports.h and exsltexports.h



commit 299238165aeef603250bd975b37f01a0d1b30818
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Fri Jul 29 01:28:06 2022 +0200

    Simplify xsltexports.h and exsltexports.h
    
    Port the following libxml2 commit to libxslt:
    
    https://gitlab.gnome.org/GNOME/libxml2/-/commit/acdc2ff3607fe003c2febc25f28954146b3c1636
    
    Fixes #71.

 libexslt/exsltexports.h | 141 +++++++++++------------------------------------
 libxslt/xsltexports.h   | 142 +++++++++++-------------------------------------
 2 files changed, 64 insertions(+), 219 deletions(-)
---
diff --git a/libexslt/exsltexports.h b/libexslt/exsltexports.h
index 381567e0..ee79ec7a 100644
--- 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:
- *
- * Macros which declare an exportable function
- */
-#define EXSLTPUBFUN
-/**
- * EXSLTPUBVAR:
+ * EXSLTPUBLIC:
  *
- * Macros which declare an exportable variable
+ * Macro which declares a public symbol
  */
-#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
-
-/* 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
+#endif /* platform switch */
 
-/* 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
+ * EXSLTPUBFUN:
+ *
+ * Macro which declares an exportable function
+ */
+#define EXSLTPUBFUN EXSLTPUBLIC
 
-/* 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
index 99b6ac38..95c352fe 100644
--- 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:
- *
- * Macros which declare an exportable function
- */
-#define XSLTPUBFUN
-/**
- * XSLTPUBVAR:
+ * XSLTPUBLIC:
  *
- * Macros which declare an exportable variable
+ * Macro which declares a public symbol
  */
-#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
-
-/* 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
+#endif /* platform switch */
 
-/* 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
+ * XSLTPUBFUN:
+ *
+ * Macro which declares an exportable function
+ */
+#define XSLTPUBFUN XSLTPUBLIC
 
-/* 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]