mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
PL/Perl portability fix: absorb relevant -D switches from Perl.
Back-patch of commit3c163a7fc7
, which see for more info. Also throw in commitb4cc35fbb7
, so Coverity doesn't whine about the back branches. Ashutosh Sharma, some adjustments by me Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
This commit is contained in:
@@ -298,6 +298,7 @@ else
|
||||
endif
|
||||
perl_archlibexp = @perl_archlibexp@
|
||||
perl_privlibexp = @perl_privlibexp@
|
||||
perl_embed_ccflags = @perl_embed_ccflags@
|
||||
perl_embed_ldflags = @perl_embed_ldflags@
|
||||
|
||||
# Miscellaneous
|
||||
|
@@ -12,7 +12,11 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID
|
||||
override CPPFLAGS += -Wno-comment
|
||||
endif
|
||||
|
||||
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) -I$(perl_archlibexp)/CORE
|
||||
# Note: we need to make sure that the CORE directory is included last,
|
||||
# probably because it sometimes contains some header files with names
|
||||
# that clash with some of ours, or with some that we include, notably on
|
||||
# Windows.
|
||||
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) $(perl_embed_ccflags) -I$(perl_archlibexp)/CORE
|
||||
|
||||
rpathdir = $(perl_archlibexp)/CORE
|
||||
|
||||
|
@@ -3248,12 +3248,18 @@ plperl_return_next_internal(SV *sv)
|
||||
|
||||
/*
|
||||
* This is the first call to return_next in the current PL/Perl
|
||||
* function call, so memoize some lookups
|
||||
* function call, so identify the output tuple descriptor and create a
|
||||
* tuplestore to hold the result rows.
|
||||
*/
|
||||
if (prodesc->fn_retistuple)
|
||||
(void) get_call_result_type(fcinfo, NULL, &tupdesc);
|
||||
else
|
||||
{
|
||||
tupdesc = rsi->expectedDesc;
|
||||
/* Protect assumption below that we return exactly one column */
|
||||
if (tupdesc == NULL || tupdesc->natts != 1)
|
||||
elog(ERROR, "expected single-column result descriptor for non-composite SETOF result");
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure the tuple_store and ret_tdesc are sufficiently
|
||||
@@ -3301,20 +3307,20 @@ plperl_return_next_internal(SV *sv)
|
||||
}
|
||||
else
|
||||
{
|
||||
Datum ret;
|
||||
bool isNull;
|
||||
Datum ret[1];
|
||||
bool isNull[1];
|
||||
|
||||
ret = plperl_sv_to_datum(sv,
|
||||
prodesc->result_oid,
|
||||
-1,
|
||||
fcinfo,
|
||||
&prodesc->result_in_func,
|
||||
prodesc->result_typioparam,
|
||||
&isNull);
|
||||
ret[0] = plperl_sv_to_datum(sv,
|
||||
prodesc->result_oid,
|
||||
-1,
|
||||
fcinfo,
|
||||
&prodesc->result_in_func,
|
||||
prodesc->result_typioparam,
|
||||
&isNull[0]);
|
||||
|
||||
tuplestore_putvalues(current_call_data->tuple_store,
|
||||
current_call_data->ret_tdesc,
|
||||
&ret, &isNull);
|
||||
ret, isNull);
|
||||
}
|
||||
|
||||
MemoryContextSwitchTo(old_cxt);
|
||||
|
@@ -516,7 +516,26 @@ sub mkvcbuild
|
||||
my $plperl =
|
||||
$solution->AddProject('plperl', 'dll', 'PLs', 'src/pl/plperl');
|
||||
$plperl->AddIncludeDir($solution->{options}->{perl} . '/lib/CORE');
|
||||
$plperl->AddDefine('PLPERL_HAVE_UID_GID');
|
||||
|
||||
# Add defines from Perl's ccflags; see PGAC_CHECK_PERL_EMBED_CCFLAGS
|
||||
my @perl_embed_ccflags;
|
||||
foreach my $f (split(" ",$Config{ccflags}))
|
||||
{
|
||||
if ($f =~ /^-D[^_]/)
|
||||
{
|
||||
$f =~ s/\-D//;
|
||||
push(@perl_embed_ccflags, $f);
|
||||
}
|
||||
}
|
||||
|
||||
# XXX this probably is redundant now?
|
||||
push(@perl_embed_ccflags, 'PLPERL_HAVE_UID_GID');
|
||||
|
||||
foreach my $f (@perl_embed_ccflags)
|
||||
{
|
||||
$plperl->AddDefine($f);
|
||||
}
|
||||
|
||||
foreach my $xs ('SPI.xs', 'Util.xs')
|
||||
{
|
||||
(my $xsc = $xs) =~ s/\.xs/.c/;
|
||||
@@ -599,7 +618,11 @@ sub mkvcbuild
|
||||
'hstore_plperl', 'contrib/hstore_plperl',
|
||||
'plperl', 'src/pl/plperl',
|
||||
'hstore', 'contrib/hstore');
|
||||
$hstore_plperl->AddDefine('PLPERL_HAVE_UID_GID');
|
||||
|
||||
foreach my $f (@perl_embed_ccflags)
|
||||
{
|
||||
$hstore_plperl->AddDefine($f);
|
||||
}
|
||||
}
|
||||
|
||||
$mf =
|
||||
|
Reference in New Issue
Block a user