From: Andres Freund <andres@anarazel.de>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Allow building with MSVC and Strawberry perl
Date: Fri, 25 Nov 2022 15:33:31 -0800
Message-ID: <20221125233331.dh4yrd76a3mnwj4s@awork3.anarazel.de> (raw)
In-Reply-To: <02b5e6c8-a062-94f0-1add-db1fd1db5f0b@dunslane.net>
References: <E1oyfT5-000o2o-C9@gemulon.postgresql.org>
<02b5e6c8-a062-94f0-1add-db1fd1db5f0b@dunslane.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de, andrew@dunslane.net
Subject: Re: pgsql: Allow building with MSVC and Strawberry perl
In-Reply-To: <20221125233331.dh4yrd76a3mnwj4s@awork3.anarazel.de>
References: <E1oyfT5-000o2o-C9@gemulon.postgresql.org> <02b5e6c8-a062-94f0-1add-db1fd1db5f0b@dunslane.net> <20221125233331.dh4yrd76a3mnwj4s@awork3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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