Re: partitioned tables and contrib/sepgsql

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: partitioned tables and contrib/sepgsql
Дата
Msg-id 2a3b192d-3e52-5611-0fa3-a1e62c7be7c1@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: partitioned tables and contrib/sepgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 4/5/17 01:20, Tom Lane wrote:
>> The complaint about bool is also just a warning.
> 
> Really?
> 
> $ cat test.c
> typedef char bool;
> typedef char bool;
> $ gcc -c test.c
> test.c:2: error: redefinition of typedef 'bool'
> test.c:1: note: previous declaration of 'bool' was here
> 
> This is with gcc 4.4.7.

But the above is not how the current code looks.

stdbool.h does

#define bool _Bool

c.h does

#ifndef bool
typedef char bool;
#endif

So if you get stdbool.h first, then c.h does nothing.  If you get c.h
first, then the macro from stdbool.h will mask the c.h typedef.

Where this gets really fun is when you include other header files
between, say, postgres.h and selinux/label.h, because then the function
definitions from those header files will be incompatible before and
after the stdbool.h inclusion.  Which indeed currently leads to the
following compilation error:

label.c: In function ‘sepgsql_init_client_label’:
label.c:437:18: error: assignment from incompatible pointer type
[-Werror=incompatible-pointer-types] needs_fmgr_hook = sepgsql_needs_fmgr_hook;                 ^

So I can't reproduce the original complaint, but this is potentially worse.

(The above is on Fedora 25.  You need a fairly new selinux.)

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



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: scram and \password
Следующее
От: Tom Lane
Дата:
Сообщение: Re: partitioned tables and contrib/sepgsql