Re: pgsql: Fix for globals.c- c.h must come first

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Fix for globals.c- c.h must come first
Дата
Msg-id 1904.1529431755@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Fix for globals.c- c.h must come first  (Bruce Momjian <bruce@momjian.us>)
Ответы Re: pgsql: Fix for globals.c- c.h must come first  (Andres Freund <andres@anarazel.de>)
Список pgsql-committers
Bruce Momjian <bruce@momjian.us> writes:
> On Sat, May 19, 2018 at 01:20:47AM +0000, Stephen Frost wrote:
>> Commit da9b580 mistakenly put a system header before postgres.h (which
>> includes c.h).  That can cause portability issues and broke (at least)
>> builds with older Windows compilers.

> I assume there is no way to add defined and checks to globals.c and c.h
> to cause a compile error when this happens.

Hm.  You could imagine adding something like

#ifdef some-relevant-macro
#error include ordering problem, c.h must come before system headers
#endif

near the head of c.h.  But I'm not sure how we'd get full coverage.
The case presumably would only occur for off-the-beaten-path headers
(this particular mistake was <sys/stat.h>), and there are lots of those.

            regards, tom lane


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Fix for globals.c- c.h must come first
Следующее
От: Andres Freund
Дата:
Сообщение: Re: pgsql: Fix for globals.c- c.h must come first