pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Use stdbool.h if suitable
4+ messages / 2 participants
[nested] [flat]
* pgsql: Use stdbool.h if suitable
@ 2018-03-23 00:42 Peter Eisentraut <peter_e@gmx.net>
2018-03-23 01:25 ` Re: pgsql: Use stdbool.h if suitable Andres Freund <andres@anarazel.de>
2018-03-23 05:22 ` Re: pgsql: Use stdbool.h if suitable Andres Freund <andres@anarazel.de>
0 siblings, 2 replies; 4+ messages in thread
From: Peter Eisentraut @ 2018-03-23 00:42 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Use stdbool.h if suitable
Using the standard bool type provided by C allows some recent compilers
and debuggers to give better diagnostics. Also, some extension code and
third-party headers are increasingly pulling in stdbool.h, so it's
probably saner if everyone uses the same definition.
But PostgreSQL code is not prepared to handle bool of a size other than
1, so we keep our own old definition if we encounter a stdbool.h with a
bool of a different size. (Among current build farm members, this only
applies to old macOS versions on PowerPC.)
To check that the used bool is of the right size, add a static
assertions about size of GinTernaryValue vs bool. This is currently the
only place that assumes that bool and char are of the same size.
Discussion: https://www.postgresql.org/message-id/flat/3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/9a95a77d9d5d3003d2d67121f2731b6e5fc37336
Modified Files
--------------
src/backend/utils/adt/tsginidx.c | 4 +++-
src/include/access/gin.h | 4 ++--
src/include/c.h | 14 ++++++++++++--
src/include/pg_config.h.win32 | 9 +++++++++
src/pl/plperl/plperl.h | 10 +++++-----
5 files changed, 31 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Use stdbool.h if suitable
2018-03-23 00:42 pgsql: Use stdbool.h if suitable Peter Eisentraut <peter_e@gmx.net>
@ 2018-03-23 01:25 ` Andres Freund <andres@anarazel.de>
2018-03-23 06:22 ` Re: pgsql: Use stdbool.h if suitable Andres Freund <andres@anarazel.de>
1 sibling, 1 reply; 4+ messages in thread
From: Andres Freund @ 2018-03-23 01:25 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@lists.postgresql.org
Hi,
On 2018-03-23 00:42:39 +0000, Peter Eisentraut wrote:
> Use stdbool.h if suitable
>
> Using the standard bool type provided by C allows some recent compilers
> and debuggers to give better diagnostics. Also, some extension code and
> third-party headers are increasingly pulling in stdbool.h, so it's
> probably saner if everyone uses the same definition.
Hah. I was setting up LLVM buildfarm animals that run with LLVM
assertions enabled, and was getting confused why they're failing after
I'd run a check-world locally with assertions enabled.
Turns out this broke it. I'll fix it. Just amazed that we've gone weeks
without a change breaking my JIT work, and then within hours of it
getting it got broken. Turns out LLVM represents a stdbool.h boolean as
an i1 (int with 1 bit) rather than an i8 (int with 8 bits), which makes
sense given the desired boolean behaviour (still takes 8 bits of
storage).
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Use stdbool.h if suitable
2018-03-23 00:42 pgsql: Use stdbool.h if suitable Peter Eisentraut <peter_e@gmx.net>
2018-03-23 01:25 ` Re: pgsql: Use stdbool.h if suitable Andres Freund <andres@anarazel.de>
@ 2018-03-23 06:22 ` Andres Freund <andres@anarazel.de>
0 siblings, 0 replies; 4+ messages in thread
From: Andres Freund @ 2018-03-23 06:22 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@lists.postgresql.org
On 2018-03-22 18:25:01 -0700, Andres Freund wrote:
> Hi,
>
> On 2018-03-23 00:42:39 +0000, Peter Eisentraut wrote:
> > Use stdbool.h if suitable
> >
> > Using the standard bool type provided by C allows some recent compilers
> > and debuggers to give better diagnostics. Also, some extension code and
> > third-party headers are increasingly pulling in stdbool.h, so it's
> > probably saner if everyone uses the same definition.
>
> Hah. I was setting up LLVM buildfarm animals that run with LLVM
> assertions enabled, and was getting confused why they're failing after
> I'd run a check-world locally with assertions enabled.
>
> Turns out this broke it. I'll fix it. Just amazed that we've gone weeks
> without a change breaking my JIT work, and then within hours of it
> getting it got broken. Turns out LLVM represents a stdbool.h boolean as
> an i1 (int with 1 bit) rather than an i8 (int with 8 bits), which makes
> sense given the desired boolean behaviour (still takes 8 bits of
> storage).
Pushed a fix. There's now an array of llvm with assertion using
buildfarm animals. The one I was trying to setup, shows the before/after
now:
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=xenodermus&br=HEAD
- Andres
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Use stdbool.h if suitable
2018-03-23 00:42 pgsql: Use stdbool.h if suitable Peter Eisentraut <peter_e@gmx.net>
@ 2018-03-23 05:22 ` Andres Freund <andres@anarazel.de>
1 sibling, 0 replies; 4+ messages in thread
From: Andres Freund @ 2018-03-23 05:22 UTC (permalink / raw)
To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers@lists.postgresql.org
Hi,
On 2018-03-23 00:42:39 +0000, Peter Eisentraut wrote:
> Use stdbool.h if suitable
>
> Using the standard bool type provided by C allows some recent compilers
> and debuggers to give better diagnostics. Also, some extension code and
> third-party headers are increasingly pulling in stdbool.h, so it's
> probably saner if everyone uses the same definition.
>
> But PostgreSQL code is not prepared to handle bool of a size other than
> 1, so we keep our own old definition if we encounter a stdbool.h with a
> bool of a different size. (Among current build farm members, this only
> applies to old macOS versions on PowerPC.)
>
> To check that the used bool is of the right size, add a static
> assertions about size of GinTernaryValue vs bool. This is currently the
> only place that assumes that bool and char are of the same size.
This appears to have broken buildfarm animal locust:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=locust&dt=2018-03-23%2001%3A13%3A30
I suspect that's because of the perl hunk
> src/pl/plperl/plperl.h | 10 +++++-----
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-03-23 06:22 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 00:42 pgsql: Use stdbool.h if suitable Peter Eisentraut <peter_e@gmx.net>
2018-03-23 01:25 ` Andres Freund <andres@anarazel.de>
2018-03-23 06:22 ` Andres Freund <andres@anarazel.de>
2018-03-23 05:22 ` Andres Freund <andres@anarazel.de>
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