GinPageIs* don't actually return a boolean

Поиск
Список
Период
Сортировка
От Andres Freund
Тема GinPageIs* don't actually return a boolean
Дата
Msg-id 20150811154237.GD17575@awork2.anarazel.de
обсуждение исходный текст
Ответы Re: GinPageIs* don't actually return a boolean  (Andres Freund <andres@anarazel.de>)
Re: GinPageIs* don't actually return a boolean  (Robert Haas <robertmhaas@gmail.com>)
Re: GinPageIs* don't actually return a boolean  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

#define GinPageIsLeaf(page)    ( GinPageGetOpaque(page)->flags & GIN_LEAF )
#define GinPageIsData(page)    ( GinPageGetOpaque(page)->flags & GIN_DATA )
#define GinPageIsList(page)    ( GinPageGetOpaque(page)->flags & GIN_LIST )
...

These macros don't actually return a boolean that's comparable with our
true/false. That doesn't strike me as a good idea.

If there's actually a boolean type defined by some included header (in
which case we don't overwrite it in c.h!) this actually can lead to
tests failing. If e.g. stdbool.h is included in c.h the tests fail with
gcc-4.9.

I think we should add a !! to these macros to make sure it's an actual
boolean.

This has been the case since gin's initial commit in 8a3631f8d86cdd9b0 .

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: 64-bit XIDs again
Следующее
От: Fabien COELHO
Дата:
Сообщение: pgbench bug in head