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 2503.1529432396@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Fix for globals.c- c.h must come first  (Andres Freund <andres@anarazel.de>)
Ответы Re: pgsql: Fix for globals.c- c.h must come first  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pgsql: Fix for globals.c- c.h must come first  (Andres Freund <andres@anarazel.de>)
Список pgsql-committers
Andres Freund <andres@anarazel.de> writes:
> On 2018-06-19 14:09:15 -0400, Tom Lane wrote:
>> 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.

> If we were ok with doing this in a very platform specific manner, we
> probably could make the dependency fairly generic. I.e. glibc IIRC will
> pretty much always end up including features.h, so we could check for
> that (#ifdef _FEATURES_H).  I'd suspect other C libraries have similar
> things.

It'd probably be good enough if the error detection worked with glibc's
headers.  Even if nobody noticed before a particular patch went in,
the buildfarm would surely find it.

            regards, tom lane


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

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