summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/lib/CORE/win32.h
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-10 21:56:14 +0000
committerKarl Berry <karl@freefriends.org>2019-03-10 21:56:14 +0000
commite0a2a718e89f9700d627f1e6a8eea8f21d2fbeb8 (patch)
tree39972f65008b0d70f306a5f976494d29411bc41e /Master/tlpkg/tlperl/lib/CORE/win32.h
parentb206fdc77d81ed1600949062f08de5690a4bf66f (diff)
tl19 perl 5.28.1 for Windows, from Siep
git-svn-id: svn://tug.org/texlive/trunk@50322 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/tlperl/lib/CORE/win32.h')
-rw-r--r--Master/tlpkg/tlperl/lib/CORE/win32.h48
1 files changed, 33 insertions, 15 deletions
diff --git a/Master/tlpkg/tlperl/lib/CORE/win32.h b/Master/tlpkg/tlperl/lib/CORE/win32.h
index 6de9c9b7264..26c3ac254f3 100644
--- a/Master/tlpkg/tlperl/lib/CORE/win32.h
+++ b/Master/tlpkg/tlperl/lib/CORE/win32.h
@@ -103,23 +103,42 @@
* The XS code in the re extension is special, in that it redefines
* core APIs locally, so don't mark them as "dllimport" because GCC
* cannot handle this situation.
+ *
+ * Certain old GCCs will not allow the function pointer of dllimport marked
+ * function to be "const". This was fixed later on. Since this is a
+ * deoptimization, target "gcc version 3.4.5 (mingw-vista special r3)" only,
+ * The GCC bug was fixed in GCC patch "varasm.c (initializer_constant_valid_p):
+ * Don't deny DECL_DLLIMPORT_P on functions", which probably was first released
+ * in GCC 4.3.0, this #if can be expanded upto but not including 4.3.0 if more
+ * deployed GCC are found that wont build with the follow error, initializer
+ * element is a PerlIO func exported from perl5xx.dll.
+ *
+ * encoding.xs:610: error: initializer element is not constant
+ * encoding.xs:610: error: (near initialization for `PerlIO_encode.Open')
*/
-#if !defined(PERLDLL) && !defined(PERL_EXT_RE_BUILD)
-# ifdef __cplusplus
-# define PERL_CALLCONV extern "C" __declspec(dllimport)
-# ifdef _MSC_VER
-# define PERL_CALLCONV_NO_RET extern "C" __declspec(dllimport) __declspec(noreturn)
+
+#if (defined(__GNUC__) && defined(__MINGW32__) && \
+ !defined(__MINGW64_VERSION_MAJOR) && !defined(__clang__) && \
+ ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 5))))
+/* use default fallbacks from perl.h for this particular GCC */
+#else
+# if !defined(PERLDLL) && !defined(PERL_EXT_RE_BUILD)
+# ifdef __cplusplus
+# define PERL_CALLCONV extern "C" __declspec(dllimport)
+# ifdef _MSC_VER
+# define PERL_CALLCONV_NO_RET extern "C" __declspec(dllimport) __declspec(noreturn)
+# endif
+# else
+# define PERL_CALLCONV __declspec(dllimport)
+# ifdef _MSC_VER
+# define PERL_CALLCONV_NO_RET __declspec(dllimport) __declspec(noreturn)
+# endif
# endif
-# else
-# define PERL_CALLCONV __declspec(dllimport)
+# else /* MSVC noreturn support inside the interp */
# ifdef _MSC_VER
-# define PERL_CALLCONV_NO_RET __declspec(dllimport) __declspec(noreturn)
+# define PERL_CALLCONV_NO_RET __declspec(noreturn)
# endif
# endif
-#else /* MSVC noreturn support inside the interp */
-# ifdef _MSC_VER
-# define PERL_CALLCONV_NO_RET __declspec(noreturn)
-# endif
#endif
#ifdef _MSC_VER
@@ -199,7 +218,6 @@ struct utsname {
#endif
#endif
-#define STANDARD_C 1
#define DOSISH 1 /* no escaping our roots */
#define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */
@@ -296,7 +314,7 @@ __PL_nan_u = { 0x7FF8000000000000UI64 };
#if _MSC_VER >= 1900
/* No longer declared in stdio.h */
-char *gets(char* buffer);
+EXTERN_C char *gets(char* buffer);
#define tzname _tzname
@@ -326,7 +344,7 @@ typedef struct
#define PERLIO_FILE_base(f) (((__crt_stdio_stream_data*)(f))->_base)
#define PERLIO_FILE_cnt(f) (((__crt_stdio_stream_data*)(f))->_cnt)
#define PERLIO_FILE_flag(f) ((int)(((__crt_stdio_stream_data*)(f))->_flags))
-#define PERLIO_FILE_file(f) ((int)(((__crt_stdio_stream_data*)(f))->_file))
+#define PERLIO_FILE_file(f) (*(int*)(&((__crt_stdio_stream_data*)(f))->_file))
#endif