pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow building with MSVC and Strawberry perl
11+ messages / 2 participants
[nested] [flat]

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9fe5cff141388316779bcc6662ca2d2cd0e53872

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fed54fc9a5819d43ab60518306925c38f5e2bc43

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f76191fd994aa1e49110b496f6c7119052118dee

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/341f4e002d461a3c5513cb864490cddae2b43a64

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/171c7fffaa4a3f2b000f980ecb33c2f7441a9a03

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 20:38  Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 20:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow building with MSVC and Strawberry perl

Strawberry uses __builtin_expect which Visual C doesn't have. For this
case define it as a noop. Solution taken from vim sources.

Backpatch to all live branches

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ae7c5121307d5c8b92b4e0ac63ec2e8635d8c076

Modified Files
--------------
src/pl/plperl/plperl.h | 2 ++
1 file changed, 2 insertions(+)



^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 22:11  Andrew Dunstan <andrew@dunslane.net>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 22:11 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org


On 2022-11-25 Fr 15:38, Andrew Dunstan wrote:
> Allow building with MSVC and Strawberry perl
>
> Strawberry uses __builtin_expect which Visual C doesn't have. For this
> case define it as a noop. Solution taken from vim sources.


Argh! drongo doesn't seem to like this. I thought I'd tested it.

A little further googling suggests that instead of


#define __builtin_expect(expr, val) (expr)


we should probably have something like


#define __builtin_expect(expr, val) ((expr) == (val))


I'll try that.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 23:33  Andres Freund <andres@anarazel.de>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 1 reply; 11+ messages in thread

From: Andres Freund @ 2022-11-25 23:33 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2022-11-25 17:11:51 -0500, Andrew Dunstan wrote:
> On 2022-11-25 Fr 15:38, Andrew Dunstan wrote:
> > Allow building with MSVC and Strawberry perl
> >
> > Strawberry uses __builtin_expect which Visual C doesn't have. For this
> > case define it as a noop. Solution taken from vim sources.

FWIW, to get a newer strawberry perl to work with msvc we need more than
this. At the very least -DNO_THREAD_SAFE_LOCALE, see

https://postgr.es/m/20220130221659.tlyr2lbw3wk22owg%40alap3.anarazel.de



>
> Argh! drongo doesn't seem to like this. I thought I'd tested it.
>
> A little further googling suggests that instead of
>
>
> #define __builtin_expect(expr, val) (expr)
>
>
> we should probably have something like
>
>
> #define __builtin_expect(expr, val) ((expr) == (val))

That doesn't seem right - val isn't something to compare to, it's the expected
return value. This afaict would compute bogus value in a number of scenarios.

Note that perl's own definition is:

#ifdef HAS_BUILTIN_EXPECT
#  define EXPECT(expr,val)                  __builtin_expect(expr,val)
#else
#  define EXPECT(expr,val)                  (expr)
#endif

So we really should be able to get away with
#define __builtin_expect(expr, val) (expr)


I don't see why drongo's problems would go away with
#define __builtin_expect(expr, val) ((expr) == (val))
anyway?


FWIW a meson build with msvc 2019 and strawberry perl 5.32 builds fine with
#define __builtin_expect(expr, val) (expr)

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 23:48  Andres Freund <andres@anarazel.de>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Andres Freund @ 2022-11-25 23:48 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2022-11-25 15:33:31 -0800, Andres Freund wrote:
> FWIW a meson build with msvc 2019 and strawberry perl 5.32 builds fine with
> #define __builtin_expect(expr, val) (expr)

And it does so with src/tools/msvc as well.  I think we might need a
preprocessed plperl.c from drongo to analyze this further.

There might be some unrelated under-specified build issues, I get weird errors
if I start by building plperl.vcxproj, without first having built
postgres.vcxproj. But ...

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-25 23:56  Andrew Dunstan <andrew@dunslane.net>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 11+ messages in thread

From: Andrew Dunstan @ 2022-11-25 23:56 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org


On 2022-11-25 Fr 18:48, Andres Freund wrote:
> Hi,
>
> On 2022-11-25 15:33:31 -0800, Andres Freund wrote:
>> FWIW a meson build with msvc 2019 and strawberry perl 5.32 builds fine with
>> #define __builtin_expect(expr, val) (expr)
> And it does so with src/tools/msvc as well.  I think we might need a
> preprocessed plperl.c from drongo to analyze this further.
>
> There might be some unrelated under-specified build issues, I get weird errors
> if I start by building plperl.vcxproj, without first having built
> postgres.vcxproj. But ...
>


Yeah, drongo builds fine too. It's the handshake thing that's the
current issue. I'll see if forcing -DNO_THREAD_SAFE_LOCALE works.


Thanks


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com






^ permalink  raw  reply  [nested|flat] 11+ messages in thread

* Re: pgsql: Allow building with MSVC and Strawberry perl
@ 2022-11-26 00:22  Andres Freund <andres@anarazel.de>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 11+ messages in thread

From: Andres Freund @ 2022-11-26 00:22 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2022-11-25 18:56:02 -0500, Andrew Dunstan wrote:
> On 2022-11-25 Fr 18:48, Andres Freund wrote:
> > On 2022-11-25 15:33:31 -0800, Andres Freund wrote:
> >> FWIW a meson build with msvc 2019 and strawberry perl 5.32 builds fine with
> >> #define __builtin_expect(expr, val) (expr)
> > And it does so with src/tools/msvc as well.  I think we might need a
> > preprocessed plperl.c from drongo to analyze this further.
> >
> > There might be some unrelated under-specified build issues, I get weird errors
> > if I start by building plperl.vcxproj, without first having built
> > postgres.vcxproj. But ...
> >
> 
> 
> Yeah, drongo builds fine too.

Oh - I just looked at HEAD, where it fails in the 'make' stage on the BF. But
I now see the PLCheck-C failures in the older branches.


> It's the handshake thing that's the current issue. I'll see if forcing
> -DNO_THREAD_SAFE_LOCALE works.

With it tests do pass for me with meson + msvc + perl 5.32.

Greetings,

Andres Freund





^ permalink  raw  reply  [nested|flat] 11+ messages in thread


end of thread, other threads:[~2022-11-26 00:22 UTC | newest]

Thread overview: 11+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>
2022-11-25 22:11 ` Andrew Dunstan <andrew@dunslane.net>
2022-11-25 23:33   ` Andres Freund <andres@anarazel.de>
2022-11-25 23:48     ` Andres Freund <andres@anarazel.de>
2022-11-25 23:56       ` Andrew Dunstan <andrew@dunslane.net>
2022-11-26 00:22         ` Andres Freund <andres@anarazel.de>
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>
2022-11-25 20:38 pgsql: Allow building with MSVC and Strawberry perl Andrew Dunstan <andrew@dunslane.net>

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