Re: taking stdbool.h into use

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: taking stdbool.h into use
Date: 2017-09-14 18:56:22
Message-ID: 6e1a704f-7d98-3833-3ed7-79480da5f605@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On 8/16/17 02:32, Thomas Munro wrote:
>> 0001-Fix-bool-int-type-confusion.patch
>
> Looks good.

Committed that one.

>> 0002-Change-TRUE-FALSE-to-true-false.patch
>
> Looks good. What about these?

OK, did more digging. Windows, ICU, and Perl define their own
TRUE/FALSE, so in those uses we don't have to make any changes. ECPG
also has its own definitions. In ECPG I also found some obsolete uses
for bools that have been fixed in the equivalent backend code a long
time ago, so I added patches to fix that. And another use in
src/backend/port/dynloader/darwin.c was probably wrong to begin with as
well.

I also went through all the comments to make equivalent changes. I kept
that in a separate patch for easier viewing, but it should probably be
committed together.

Using a case-insensitive diff mechanism one can verify that no logic was
changed here.

>> 0003-Remove-TRUE-and-FALSE.patch
>
> Looks good. What about these?
>
> src/interfaces/ecpg/include/ecpglib.h:#define FALSE 0
> src/interfaces/ecpg/pgtypeslib/extern.h:#define FALSE 0

Not sure about that. These are available for use by ecpg applications,
and it's perhaps not worth disrupting that.

>> 0004-Remove-BoolPtr-type.patch
>
> Looks good.

Committed that one.

>> 0007-Avoid-use-of-bool-in-thread_test.c.patch
>
> Looks good.

and that one

>> 0005-Make-casting-between-bool-and-GinTernaryValue-more-r.patch
>> 0008-Use-stdbool.h-if-available.patch

These need some more work based on Tom's feedback.

Attached is a new patch set. Based on the discussion so far, 0001
through 0007 might be ready; the other two need some more work.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Fix-incorrect-use-of-bool.patch text/plain 970 bytes
v2-0002-ecpg-Remove-useless-return-values.patch text/plain 5.6 KB
v2-0003-ecpg-Use-bool-instead-of-int.patch text/plain 1.9 KB
v2-0004-Change-TRUE-FALSE-to-true-false.patch text/plain 181.7 KB
v2-0005-Change-TRUE-FALSE-to-true-false-in-comments.patch text/plain 171.7 KB
v2-0006-Remove-TRUE-and-FALSE.patch text/plain 1.5 KB
v2-0007-Add-bool8-typedef-for-system-catalog-structs.patch text/plain 24.2 KB
v2-0008-Make-casting-between-bool-and-GinTernaryValue-mor.patch text/plain 2.4 KB
v2-0009-Use-stdbool.h-if-available.patch text/plain 12.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2017-09-14 19:04:54 Re: DROP SUBSCRIPTION hangs if sub is disabled in the same transaction
Previous Message Andreas Joseph Krogh 2017-09-14 18:49:24 Re: Clarification in pg10's pgupgrade.html step 10 (upgrading standby servers)