gmp.h uses undefined preprocessor symbol

Simon Sobisch simonsobisch at gnu.org
Sat Oct 19 20:54:58 UTC 2019


The following bug exists since at least GMP 4.3 and still persists:

gmp-h.in defines _GMP_DECLSPEC_EXPORT / _GMP_DECLSPEC_IMPORT for
different systems and use it later.

The problem: it does not define it to something for unknown environments.

The attached patch defines them empty when the compiler is not known and
adds the working definition for the OrangeC compiler.

[Note: the patch used the old format, ORANGEC understands both
´__dllexport__´ and ´dllexport´ so it may be added to the GCC-define]

Simon
-------------- next part --------------
Index: gmp-h.in
===================================================================
--- gmp-h.old.in
+++ gmp-h.in
@@ -168,18 +168,18 @@
 #if defined (__GNUC__)
 #define __GMP_DECLSPEC_EXPORT  __declspec(__dllexport__)
 #define __GMP_DECLSPEC_IMPORT  __declspec(__dllimport__)
-#endif
-#if defined (_MSC_VER) || defined (__BORLANDC__)
+#elif defined (_MSC_VER) || defined (__BORLANDC__) || defined (__ORANGEC__)
 #define __GMP_DECLSPEC_EXPORT  __declspec(dllexport)
 #define __GMP_DECLSPEC_IMPORT  __declspec(dllimport)
-#endif
-#ifdef __WATCOMC__
+#elif defined (__WATCOMC__)
 #define __GMP_DECLSPEC_EXPORT  __export
 #define __GMP_DECLSPEC_IMPORT  __import
-#endif
-#ifdef __IBMC__
+#elif defined (__IBMC__)
 #define __GMP_DECLSPEC_EXPORT  _Export
 #define __GMP_DECLSPEC_IMPORT  _Import
+#else
+#define __GMP_DECLSPEC_EXPORT
+#define __GMP_DECLSPEC_IMPORT
 #endif
 
 #if defined( _MSC_VER )


More information about the gmp-bugs mailing list