|
14 | 14 | #ifndefPL_PERL_H |
15 | 15 | #definePL_PERL_H |
16 | 16 |
|
17 | | -/* stop perl headers from hijacking stdio and other stuff on Windows */ |
18 | | -#ifdefWIN32 |
19 | | -#defineWIN32IO_IS_STDIO |
20 | | -#endif/* WIN32 */ |
21 | | - |
22 | | -/* |
23 | | - * Supply a value of PERL_UNUSED_DECL that will satisfy gcc - the one |
24 | | - * perl itself supplies doesn't seem to. |
25 | | - */ |
26 | | -#definePERL_UNUSED_DECL pg_attribute_unused() |
27 | | - |
28 | | -/* |
29 | | - * Sometimes perl carefully scribbles on our *printf macros. |
30 | | - * So we undefine them here and redefine them after it's done its dirty deed. |
31 | | - */ |
32 | | -#undef vsnprintf |
33 | | -#undef snprintf |
34 | | -#undef vsprintf |
35 | | -#undef sprintf |
36 | | -#undef vfprintf |
37 | | -#undef fprintf |
38 | | -#undef vprintf |
39 | | -#undef printf |
40 | | - |
41 | | -/* |
42 | | - * Perl scribbles on the "_" macro too. |
43 | | - */ |
44 | | -#undef _ |
45 | | - |
46 | | -/* |
47 | | - * ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's |
48 | | - * __inline__. Translate to something MSVC recognizes. Also, perl.h sometimes |
49 | | - * defines isnan, so undefine it here and put back the definition later if |
50 | | - * perl.h doesn't. |
51 | | - */ |
52 | | -#ifdef_MSC_VER |
53 | | -#define__inline__ inline |
54 | | -#ifdefisnan |
55 | | -#undef isnan |
56 | | -#endif |
57 | | -/* Work around for using MSVC and Strawberry Perl >= 5.30. */ |
58 | | -#define__builtin_expect(expr,val) (expr) |
59 | | -#endif |
60 | | - |
61 | | -/* |
62 | | - * Regarding bool, both PostgreSQL and Perl might use stdbool.h or not, |
63 | | - * depending on configuration. If both agree, things are relatively harmless. |
64 | | - * If not, things get tricky. If PostgreSQL does but Perl does not, define |
65 | | - * HAS_BOOL here so that Perl does not redefine bool; this avoids compiler |
66 | | - * warnings. If PostgreSQL does not but Perl does, we need to undefine bool |
67 | | - * after we include the Perl headers; see below. |
68 | | - */ |
69 | | -#ifdefPG_USE_STDBOOL |
70 | | -#defineHAS_BOOL 1 |
71 | | -#endif |
72 | | - |
73 | | -/* |
74 | | - * Newer versions of the perl headers trigger a lot of warnings with our |
75 | | - * compiler flags (at least -Wdeclaration-after-statement, |
76 | | - * -Wshadow=compatible-local are known to be problematic). The system_header |
77 | | - * pragma hides warnings from within the rest of this file, if supported. |
78 | | - */ |
79 | | -#ifdefHAVE_PRAGMA_GCC_SYSTEM_HEADER |
80 | | -#pragma GCC system_header |
81 | | -#endif |
82 | | - |
83 | 17 | /* |
84 | | - *Get the basicPerlAPI. We use PERL_NO_GET_CONTEXT mode so that our code |
85 | | - *can compile against MULTIPLICITY Perl builds without including XSUB.h. |
| 18 | + *Pull inPerlheaders via a wrapper header, to control the scope of |
| 19 | + *the system_header pragma therein. |
86 | 20 | */ |
87 | | -#definePERL_NO_GET_CONTEXT |
88 | | -#include"EXTERN.h" |
89 | | -#include"perl.h" |
90 | | - |
91 | | -/* |
92 | | - * We want to include XSUB.h only within .xs files, because on some platforms |
93 | | - * it undesirably redefines a lot of libc functions. But it must appear |
94 | | - * before ppport.h, so use a #define flag to control inclusion here. |
95 | | - */ |
96 | | -#ifdefPG_NEED_PERL_XSUB_H |
97 | | -/* |
98 | | - * On Windows, win32_port.h defines macros for a lot of these same functions. |
99 | | - * To avoid compiler warnings when XSUB.h redefines them, #undef our versions. |
100 | | - */ |
101 | | -#ifdefWIN32 |
102 | | -#undef accept |
103 | | -#undef bind |
104 | | -#undef connect |
105 | | -#undef fopen |
106 | | -#undef fstat |
107 | | -#undef kill |
108 | | -#undef listen |
109 | | -#undef lstat |
110 | | -#undef mkdir |
111 | | -#undef open |
112 | | -#undef putenv |
113 | | -#undef recv |
114 | | -#undef rename |
115 | | -#undef select |
116 | | -#undef send |
117 | | -#undef socket |
118 | | -#undef stat |
119 | | -#undef unlink |
120 | | -#endif |
121 | | - |
122 | | -#include"XSUB.h" |
123 | | -#endif |
124 | | - |
125 | | -/* put back our *printf macros ... this must match src/include/port.h */ |
126 | | -#ifdefvsnprintf |
127 | | -#undef vsnprintf |
128 | | -#endif |
129 | | -#ifdefsnprintf |
130 | | -#undef snprintf |
131 | | -#endif |
132 | | -#ifdefvsprintf |
133 | | -#undef vsprintf |
134 | | -#endif |
135 | | -#ifdefsprintf |
136 | | -#undef sprintf |
137 | | -#endif |
138 | | -#ifdefvfprintf |
139 | | -#undef vfprintf |
140 | | -#endif |
141 | | -#ifdeffprintf |
142 | | -#undef fprintf |
143 | | -#endif |
144 | | -#ifdefvprintf |
145 | | -#undef vprintf |
146 | | -#endif |
147 | | -#ifdefprintf |
148 | | -#undef printf |
149 | | -#endif |
150 | | - |
151 | | -#definevsnprintfpg_vsnprintf |
152 | | -#definesnprintfpg_snprintf |
153 | | -#definevsprintfpg_vsprintf |
154 | | -#definesprintfpg_sprintf |
155 | | -#definevfprintfpg_vfprintf |
156 | | -#definefprintfpg_fprintf |
157 | | -#definevprintfpg_vprintf |
158 | | -#defineprintf(...)pg_printf(__VA_ARGS__) |
159 | | - |
160 | | -/* |
161 | | - * Put back "_" too; but rather than making it just gettext() as the core |
162 | | - * code does, make it dgettext() so that the right things will happen in |
163 | | - * loadable modules (if they've set up TEXTDOMAIN correctly). Note that |
164 | | - * we can't just set TEXTDOMAIN here, because this file is used by more |
165 | | - * extensions than just PL/Perl itself. |
166 | | - */ |
167 | | -#undef _ |
168 | | -#define_(x) dgettext(TEXTDOMAIN, x) |
169 | | - |
170 | | -/* put back the definition of isnan if needed */ |
171 | | -#ifdef_MSC_VER |
172 | | -#ifndefisnan |
173 | | -#defineisnan(x) _isnan(x) |
174 | | -#endif |
175 | | -#endif |
176 | | - |
177 | | -/* perl version and platform portability */ |
178 | | -#include"ppport.h" |
179 | | - |
180 | | -/* |
181 | | - * perl might have included stdbool.h. If we also did that earlier (see c.h), |
182 | | - * then that's fine. If not, we probably rejected it for some reason. In |
183 | | - * that case, undef bool and proceed with our own bool. (Note that stdbool.h |
184 | | - * makes bool a macro, but our own replacement is a typedef, so the undef |
185 | | - * makes ours visible again). |
186 | | - */ |
187 | | -#ifndefPG_USE_STDBOOL |
188 | | -#ifdefbool |
189 | | -#undef bool |
190 | | -#endif |
191 | | -#endif |
192 | | - |
193 | | -/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */ |
194 | | -#ifndefHeUTF8 |
195 | | -#defineHeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \ |
196 | | -SvUTF8(HeKEY_sv(he)) : \ |
197 | | -(U32)HeKUTF8(he)) |
198 | | -#endif |
199 | | - |
200 | | -/* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */ |
201 | | -#ifndefGvCV_set |
202 | | -#defineGvCV_set(gv,cv)(GvCV(gv) = cv) |
203 | | -#endif |
204 | | - |
205 | | -/* Perl 5.19.4 changed array indices from I32 to SSize_t */ |
206 | | -#ifPERL_BCDVERSION >=0x5019004 |
207 | | -#defineAV_SIZE_MAX SSize_t_MAX |
208 | | -#else |
209 | | -#defineAV_SIZE_MAX I32_MAX |
210 | | -#endif |
| 21 | +#include"plperl_system.h" |
211 | 22 |
|
212 | 23 | /* declare routines from plperl.c for access by .xs files */ |
213 | 24 | HV*plperl_spi_exec(char*,int); |
|