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

Commit58c3151

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 parentc4fe2e8 commit58c3151

File tree

8 files changed

+280
-215
lines changed

8 files changed

+280
-215
lines changed

‎src/pl/plperl/GNUmakefile

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

109109
install-data: installdirs
110110
$(INSTALL_DATA)$(addprefix$(srcdir)/,$(DATA))'$(DESTDIR)$(datadir)/extension/'
111-
$(INSTALL_DATA)$(srcdir)/plperl.h$(srcdir)/ppport.h'$(DESTDIR)$(includedir_server)'
111+
$(INSTALL_DATA)$(srcdir)/plperl.h$(srcdir)/plperl_system.h$(srcdir)/ppport.h'$(DESTDIR)$(includedir_server)'
112112

113113
uninstall-data:
114114
rm -f$(addprefix '$(DESTDIR)$(datadir)/extension'/,$(notdir$(DATA)))
115-
rm -f$(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.h ppport.h)
115+
rm -f$(addprefix '$(DESTDIR)$(includedir_server)'/, plperl.hplperl_system.hppport.h)
116116

117117
.PHONY: install-data uninstall-data
118118

‎src/pl/plperl/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ install_data(
7171

7272
install_headers(
7373
'plperl.h',
74+
'plperl_system.h',
7475
'ppport.h',
7576
install_dir: dir_include_server,
7677
)

‎src/pl/plperl/plperl.h

Lines changed: 3 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -18,200 +18,11 @@
1818
/* defines free() by way of system headers, so must be included before perl.h */
1919
#include"mb/pg_wchar.h"
2020

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp