Re: Unused header file inclusion

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Unused header file inclusion
Дата
Msg-id 20190819200750.chsvlollkl6ycizo@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Unused header file inclusion  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Unused header file inclusion  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi,

On 2019-08-18 14:37:34 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > I've pushed the other ones.
> 
> Checking whether header files compile standalone shows you were overly
> aggressive about removing fmgr.h includes:
> 
> In file included from /tmp/headerscheck.Ss8bVx/test.c:3:
> ./src/include/utils/selfuncs.h:143: error: expected declaration specifiers or '...' before 'FmgrInfo'
> ./src/include/utils/selfuncs.h:146: error: expected declaration specifiers or '...' before 'FmgrInfo'
> ./src/include/utils/selfuncs.h:152: error: expected declaration specifiers or '...' before 'FmgrInfo'

Darn.  Pushed the obvious fix of adding a direct fmgr.h include, rather
than the preivous indirect include.


> That's with a script I use that's like cpluspluscheck except it tests
> with plain gcc not g++.  I attached it for the archives' sake.
> 
> Oddly, cpluspluscheck does not complain about those cases, but it
> does complain about

Hm. I don't understand why it's not complaining. Wonder if it's a
question of the flags or such.


> In file included from /tmp/cpluspluscheck.FgX2SW/test.cpp:4:
> ./src/bin/scripts/scripts_parallel.h:18: error: ISO C++ forbids declaration of 'PGconn' with no type
> ./src/bin/scripts/scripts_parallel.h:18: error: expected ';' before '*' token
> ./src/bin/scripts/scripts_parallel.h:29: error: 'PGconn' has not been declared

I noticed that "manually" earlier, when looking at the openbsd issue.


> (My headerscheck script is missing that header; I need to update it to
> match the latest version of cpluspluscheck.)

I wonder if we should just add a #ifndef HEADERCHECK or such to the
headers that we don't want to process as standalone headers (or #ifndef
NOT_STANDALONE or whatever). That way multiple tools can rely on these markers,
rather than copying knowledge about that kind of information into
multiple places.

I wish we could move the whole logic of those scripts into makefiles, so
we could employ parallelism.

Greetings,

Andres Freund



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

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Fixing typos and inconsistencies
Следующее
От: Andres Freund
Дата:
Сообщение: Re: io_uring support