pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix interaction of Perl and stdbool.h
5+ messages / 4 participants
[nested] [flat]
* pgsql: Fix interaction of Perl and stdbool.h
@ 2018-03-23 14:33 Peter Eisentraut <peter_e@gmx.net>
2018-03-23 15:49 ` Re: pgsql: Fix interaction of Perl and stdbool.h Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Peter Eisentraut @ 2018-03-23 14:33 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix interaction of Perl and stdbool.h
Revert the PL/Perl-specific change in
9a95a77d9d5d3003d2d67121f2731b6e5fc37336. We must not prevent Perl from
using stdbool.h when it has been built to do so, even if it uses an
incompatible size. Otherwise, we would be imposing our bool on Perl,
which will lead to crashes because of the size mismatch.
Instead, we undef bool after including the Perl headers, as we did
previously, but now only if we are not using stdbool.h ourselves.
Record that choice in c.h as USE_STDBOOL. This will also make it easier
to apply that coding pattern elsewhere if necessary.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7ba7986fb4364e889a705c9973fefa138650091c
Modified Files
--------------
src/include/c.h | 1 +
src/pl/plperl/plperl.h | 18 +++++++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix interaction of Perl and stdbool.h
2018-03-23 14:33 pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter_e@gmx.net>
@ 2018-03-23 15:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-23 16:19 ` Re: pgsql: Fix interaction of Perl and stdbool.h David Steele <david@pgmasters.net>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2018-03-23 15:49 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@lists.postgresql.org
Peter Eisentraut <peter_e@gmx.net> writes:
> Fix interaction of Perl and stdbool.h
Not sure if this broke it or it was already broken, but my compiler
is now very unhappy.
In file included from /usr/lib64/perl5/CORE/perl.h:2424,
from plperl.h:60,
from SPI.xs:18:
/usr/lib64/perl5/CORE/handy.h:108:1: warning: "bool" redefined
In file included from ../../../src/include/c.h:270,
from ../../../src/include/postgres.h:46,
from SPI.xs:11:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stdbool.h:33:1: warning: this is the location of the previous definition
In file included from /usr/lib64/perl5/CORE/perl.h:2424,
from plperl.h:60,
from Util.xs:24:
/usr/lib64/perl5/CORE/handy.h:108:1: warning: "bool" redefined
In file included from ../../../src/include/c.h:270,
from ../../../src/include/postgres.h:46,
from Util.xs:14:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stdbool.h:33:1: warning: this is the location of the previous definition
In file included from /usr/lib64/perl5/CORE/perl.h:2424,
from plperl.h:60,
from plperl.c:51:
/usr/lib64/perl5/CORE/handy.h:108:1: warning: "bool" redefined
In file included from ../../../src/include/c.h:270,
from ../../../src/include/postgres.h:46,
from plperl.c:8:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stdbool.h:33:1: warning: this is the location of the previous definition
plperl.c: In function '_PG_init':
plperl.c:415: warning: passing argument 4 of 'DefineCustomBoolVariable' from incompatible pointer type
../../../src/include/utils/guc.h:282: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'select_perl_context':
plperl.c:575: warning: passing argument 4 of 'hash_search' from incompatible pointer type
../../../src/include/utils/hsearch.h:126: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_build_tuple_result':
plperl.c:1126: warning: passing argument 3 of 'heap_form_tuple' from incompatible pointer type
../../../src/include/access/htup_details.h:810: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_sv_to_literal':
plperl.c:1457: warning: passing argument 3 of 'getTypeOutputInfo' from incompatible pointer type
../../../src/include/utils/lsyscache.h:163: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_ref_from_pg_array':
plperl.c:1496: warning: passing argument 4 of 'get_type_io_data' from incompatible pointer type
../../../src/include/utils/lsyscache.h:140: note: expected '_Bool *' but argument is of type 'char *'
plperl.c:1524: warning: passing argument 7 of 'deconstruct_array' from incompatible pointer type
../../../src/include/utils/array.h:388: note: expected '_Bool **' but argument is of type 'char **'
plperl.c: In function 'plperl_modify_tuple':
plperl.c:1807: warning: passing argument 4 of 'heap_modify_tuple' from incompatible pointer type
../../../src/include/access/htup_details.h:812: note: expected '_Bool *' but argument is of type 'char *'
plperl.c:1807: warning: passing argument 5 of 'heap_modify_tuple' from incompatible pointer type
../../../src/include/access/htup_details.h:812: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_func_handler':
plperl.c:2497: warning: passing argument 7 of 'plperl_sv_to_datum' from incompatible pointer type
plperl.c:1315: note: expected 'char *' but argument is of type '_Bool *'
plperl.c: In function 'compile_plperl_function':
plperl.c:2813: warning: passing argument 4 of 'SysCacheGetAttr' from incompatible pointer type
../../../src/include/utils/syscache.h:151: note: expected '_Bool *' but argument is of type 'char *'
plperl.c:2929: warning: passing argument 4 of 'SysCacheGetAttr' from incompatible pointer type
../../../src/include/utils/syscache.h:151: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_hash_from_tuple':
plperl.c:3047: warning: passing argument 4 of 'heap_getsysattr' from incompatible pointer type
../../../src/include/access/htup_details.h:805: note: expected '_Bool *' but argument is of type 'char *'
plperl.c:3080: warning: passing argument 3 of 'getTypeOutputInfo' from incompatible pointer type
../../../src/include/utils/lsyscache.h:163: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_return_next_internal':
plperl.c:3367: warning: passing argument 4 of 'tuplestore_putvalues' from incompatible pointer type
../../../src/include/utils/tuplestore.h:56: note: expected '_Bool *' but argument is of type 'char *'
plperl.c: In function 'plperl_spi_prepare':
plperl.c:3636: warning: passing argument 4 of 'hash_search' from incompatible pointer type
../../../src/include/utils/hsearch.h:126: note: expected '_Bool *' but argument is of type 'char *'
Admittedly, these are all just warnings not errors, but that doesn't make
it acceptable.
gcc 4.4.7, perl 5.10.1, on RHEL6.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix interaction of Perl and stdbool.h
2018-03-23 14:33 pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter_e@gmx.net>
2018-03-23 15:49 ` Re: pgsql: Fix interaction of Perl and stdbool.h Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-23 16:19 ` David Steele <david@pgmasters.net>
2018-03-23 20:34 ` Re: pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 5+ messages in thread
From: David Steele @ 2018-03-23 16:19 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@lists.postgresql.org
On 3/23/18 11:49 AM, Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> Fix interaction of Perl and stdbool.h
>
> Not sure if this broke it or it was already broken, but my compiler
> is now very unhappy.
>
> In file included from /usr/lib64/perl5/CORE/perl.h:2424,
> from plperl.h:60,
> from SPI.xs:18:
> /usr/lib64/perl5/CORE/handy.h:108:1: warning: "bool" redefined
One way to fix this is to mark bool as defined in plperl.c:
#ifndef HAS_BOOL
# define HAS_BOOL 1
#endif
Regards,
--
-David
david@pgmasters.net
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix interaction of Perl and stdbool.h
2018-03-23 14:33 pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter_e@gmx.net>
2018-03-23 15:49 ` Re: pgsql: Fix interaction of Perl and stdbool.h Tom Lane <tgl@sss.pgh.pa.us>
2018-03-23 16:19 ` Re: pgsql: Fix interaction of Perl and stdbool.h David Steele <david@pgmasters.net>
@ 2018-03-23 20:34 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2018-03-23 20:48 ` Re: pgsql: Fix interaction of Perl and stdbool.h Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Peter Eisentraut @ 2018-03-23 20:34 UTC (permalink / raw)
To: David Steele <david@pgmasters.net>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On 3/23/18 12:19, David Steele wrote:
> On 3/23/18 11:49 AM, Tom Lane wrote:
>> Peter Eisentraut <peter_e@gmx.net> writes:
>>> Fix interaction of Perl and stdbool.h
>>
>> Not sure if this broke it or it was already broken, but my compiler
>> is now very unhappy.
>>
>> In file included from /usr/lib64/perl5/CORE/perl.h:2424,
>> from plperl.h:60,
>> from SPI.xs:18:
>> /usr/lib64/perl5/CORE/handy.h:108:1: warning: "bool" redefined
>
> One way to fix this is to mark bool as defined in plperl.c:
>
> #ifndef HAS_BOOL
> # define HAS_BOOL 1
> #endif
Well, that's what we had before, but that crashed on the 4-byte bool
platforms. So the fix I pushed does that only if PostgreSQL is using
stdbool.h. It works for me on CentOS 6 now.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Fix interaction of Perl and stdbool.h
2018-03-23 14:33 pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter_e@gmx.net>
2018-03-23 15:49 ` Re: pgsql: Fix interaction of Perl and stdbool.h Tom Lane <tgl@sss.pgh.pa.us>
2018-03-23 16:19 ` Re: pgsql: Fix interaction of Perl and stdbool.h David Steele <david@pgmasters.net>
2018-03-23 20:34 ` Re: pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2018-03-23 20:48 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Tom Lane @ 2018-03-23 20:48 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: David Steele <david@pgmasters.net>; pgsql-committers@lists.postgresql.org
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> Well, that's what we had before, but that crashed on the 4-byte bool
> platforms. So the fix I pushed does that only if PostgreSQL is using
> stdbool.h. It works for me on CentOS 6 now.
Works for me too, thanks!
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-03-23 20:48 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 14:33 pgsql: Fix interaction of Perl and stdbool.h Peter Eisentraut <peter_e@gmx.net>
2018-03-23 15:49 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-23 16:19 ` David Steele <david@pgmasters.net>
2018-03-23 20:34 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2018-03-23 20:48 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox