Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1613e2f

Browse files
committed
Hide warnings from Python headers when using gcc-compatible compiler.
Like commit388e801, use "#pragma GCC system_header" to silencewarnings appearing within the Python headers, since newer Pythonversions no longer worry about some restrictions we still use like-Wdeclaration-after-statement.This patch improves on388e801 by inventing a separate wrapperheader file, allowing the pragma to be tightly scoped to justthe Python headers and not other stuff we have laying about inplpython.h. I applied the same technique to plperl for the samereason: the original patch suppressed warnings for a good dealof our own code, not only the Perl headers.Like the previous commit, back-patch to supported branches.Peter Eisentraut and Tom LaneDiscussion:https://postgr.es/m/ae523163-6d2a-4b81-a875-832e48dec502@eisentraut.org
1 parentaede916 commit1613e2f

File tree

6 files changed

+388
-325
lines changed

6 files changed

+388
-325
lines changed

‎src/pl/plperl/GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ uninstall: uninstall-lib uninstall-data
101101

102102
install-data: installdirs
103103
$(INSTALL_DATA)$(addprefix$(srcdir)/,$(DATA))'$(DESTDIR)$(datadir)/extension/'
104-
$(INSTALL_DATA)$(srcdir)/plperl.h$(srcdir)/ppport.h$(srcdir)/plperl_helpers.h'$(DESTDIR)$(includedir_server)'
104+
$(INSTALL_DATA)$(srcdir)/plperl.h$(srcdir)/plperl_system.h$(srcdir)/ppport.h$(srcdir)/plperl_helpers.h'$(DESTDIR)$(includedir_server)'
105105

106106
uninstall-data:
107107
rm -f$(addprefix '$(DESTDIR)$(datadir)/extension'/,$(notdir$(DATA)))
108-
rm -f$(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h ppport.h)
108+
rm -f$(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.hplperl_system.hppport.h)
109109

110110
.PHONY: install-data uninstall-data
111111

‎src/pl/plperl/plperl.h

Lines changed: 3 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -14,199 +14,11 @@
1414
#ifndefPL_PERL_H
1515
#definePL_PERL_H
1616

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-
#ifdefUSE_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-
8317
/*
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.
8620
*/
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 kill
107-
#undef listen
108-
#undef lstat
109-
#undef mkdir
110-
#undef open
111-
#undef putenv
112-
#undef recv
113-
#undef rename
114-
#undef select
115-
#undef send
116-
#undef socket
117-
#undef stat
118-
#undef unlink
119-
#endif
120-
121-
#include"XSUB.h"
122-
#endif
123-
124-
/* put back our *printf macros ... this must match src/include/port.h */
125-
#ifdefvsnprintf
126-
#undef vsnprintf
127-
#endif
128-
#ifdefsnprintf
129-
#undef snprintf
130-
#endif
131-
#ifdefvsprintf
132-
#undef vsprintf
133-
#endif
134-
#ifdefsprintf
135-
#undef sprintf
136-
#endif
137-
#ifdefvfprintf
138-
#undef vfprintf
139-
#endif
140-
#ifdeffprintf
141-
#undef fprintf
142-
#endif
143-
#ifdefvprintf
144-
#undef vprintf
145-
#endif
146-
#ifdefprintf
147-
#undef printf
148-
#endif
149-
150-
#definevsnprintfpg_vsnprintf
151-
#definesnprintfpg_snprintf
152-
#definevsprintfpg_vsprintf
153-
#definesprintfpg_sprintf
154-
#definevfprintfpg_vfprintf
155-
#definefprintfpg_fprintf
156-
#definevprintfpg_vprintf
157-
#defineprintf(...)pg_printf(__VA_ARGS__)
158-
159-
/*
160-
* Put back "_" too; but rather than making it just gettext() as the core
161-
* code does, make it dgettext() so that the right things will happen in
162-
* loadable modules (if they've set up TEXTDOMAIN correctly). Note that
163-
* we can't just set TEXTDOMAIN here, because this file is used by more
164-
* extensions than just PL/Perl itself.
165-
*/
166-
#undef _
167-
#define_(x) dgettext(TEXTDOMAIN, x)
168-
169-
/* put back the definition of isnan if needed */
170-
#ifdef_MSC_VER
171-
#ifndefisnan
172-
#defineisnan(x) _isnan(x)
173-
#endif
174-
#endif
175-
176-
/* perl version and platform portability */
177-
#include"ppport.h"
178-
179-
/*
180-
* perl might have included stdbool.h. If we also did that earlier (see c.h),
181-
* then that's fine. If not, we probably rejected it for some reason. In
182-
* that case, undef bool and proceed with our own bool. (Note that stdbool.h
183-
* makes bool a macro, but our own replacement is a typedef, so the undef
184-
* makes ours visible again).
185-
*/
186-
#ifndefUSE_STDBOOL
187-
#ifdefbool
188-
#undef bool
189-
#endif
190-
#endif
191-
192-
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
193-
#ifndefHeUTF8
194-
#defineHeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
195-
SvUTF8(HeKEY_sv(he)) : \
196-
(U32)HeKUTF8(he))
197-
#endif
198-
199-
/* supply GvCV_set if it's missing - ppport.h doesn't supply it, unfortunately */
200-
#ifndefGvCV_set
201-
#defineGvCV_set(gv,cv)(GvCV(gv) = cv)
202-
#endif
203-
204-
/* Perl 5.19.4 changed array indices from I32 to SSize_t */
205-
#ifPERL_BCDVERSION >=0x5019004
206-
#defineAV_SIZE_MAX SSize_t_MAX
207-
#else
208-
#defineAV_SIZE_MAX I32_MAX
209-
#endif
21+
#include"plperl_system.h"
21022

21123
/* declare routines from plperl.c for access by .xs files */
21224
HV*plperl_spi_exec(char*,int);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp