]> granicus.if.org Git - postgresql/commit
Change various Gin*Is* macros to return 0/1.
authorAndres Freund <andres@anarazel.de>
Sun, 27 Mar 2016 15:47:48 +0000 (17:47 +0200)
committerAndres Freund <andres@anarazel.de>
Sun, 27 Mar 2016 15:47:48 +0000 (17:47 +0200)
commit290cc21de484da610090d5f62b98fd55e9f70ac7
tree514f38fdc8f0b049641b91a5b1acda7819a96796
parent7a68106ec50515c54505348d494642de897a9416
Change various Gin*Is* macros to return 0/1.

Returning the direct result of bit arithmetic, in a macro intended to be
used in a boolean manner, can be problematic if the return value is
stored in a variable of type 'bool'. If bool is implemented using C99's
_Bool, that can lead to comparison failures if the variable is then
compared again with the expression (see ginStepRight() for an example
that fails), as _Bool forces the result to be 0/1. That happens in some
configurations of newer MSVC compilers.  It's also problematic when
storing the result of such an expression in a narrower type.

Several gin macros have been declared in that style since gin's initial
commit in 8a3631f8d86.

There's a lot more macros like this, but this is the only one causing
regression test failures; and I don't want to commit and backpatch a
larger patch with lots of conflicts just before the next set of minor
releases.

Discussion: 20150811154237.GD17575@awork2.anarazel.de
Backpatch: All supported branches
src/include/access/gin_private.h