From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Convert contrib/seg's bool-returning SQL functions to V1 call co |
Date: | 2016-04-22 15:54:48 |
Message-ID: | E1atdPs-0005zu-Re@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Convert contrib/seg's bool-returning SQL functions to V1 call convention.
It appears that we can no longer get away with using V0 call convention
for bool-returning functions in newer versions of MSVC. The compiler
seems to generate code that doesn't clear the higher-order bits of the
result register, causing the bool result Datum to often read as "true"
when "false" was intended. This is not very surprising, since the
function thinks it's returning a bool-width result but fmgr_oldstyle
assumes that V0 functions return "char *"; what's surprising is that
that hack worked for so long on so many platforms.
The only functions of this description in core+contrib are in contrib/seg,
which we'd intentionally left mostly in V0 style to serve as a warning
canary if V0 call convention breaks. We could imagine hacking things
so that they're still V0 (we'd have to redeclare the bool-returning
functions as returning some suitably wide integer type, like size_t,
at the C level). But on the whole it seems better to convert 'em to V1.
We can still leave the pointer- and int-returning functions in V0 style,
so that the test coverage isn't gone entirely.
Back-patch to 9.5, since our intention is to support VS2015 in 9.5
and later. There's no SQL-level change in the functions' behavior
so back-patching should be safe enough.
Discussion: <22094(dot)1461273324(at)sss(dot)pgh(dot)pa(dot)us>
Michael Paquier, adjusted some by me
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/c8e81afc60093b199a128ccdfbb692ced8e0c9cd
Modified Files
--------------
contrib/seg/seg.c | 300 +++++++++++++++++++++++++++++++++++-------------------
1 file changed, 195 insertions(+), 105 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2016-04-22 20:19:20 | Re: [COMMITTERS] pgsql: Inline initial comparisons in TestForOldSnapshot() |
Previous Message | Amit Kapila | 2016-04-22 13:21:55 | Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold < |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-04-22 15:56:47 | Re: VS 2015 support in src/tools/msvc |
Previous Message | Robert Haas | 2016-04-22 15:53:46 | Re: Updated backup APIs for non-exclusive backups |