Re: Unused header file inclusion - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Unused header file inclusion
Date
Msg-id 20190731152322.GA30941@alvherre.pgsql
Whole thread Raw
In response to Unused header file inclusion  (vignesh C <vignesh21@gmail.com>)
Responses Re: Unused header file inclusion  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 2019-Jul-31, vignesh C wrote:

> I noticed that there are many header files being
> included which need not be included.

Yeah, we have tooling for this already in src/tools/pginclude.  It's
been used before, and it has wreaked considerable havoc; see "git log
--grep pgrminclude".

I think doing this sort of cleanup is useful to a point -- as Andres
mentions, some includes are somewhat more "important" than others, so
judgement is needed in each case.

I think removing unnecessary include lines from header files is much
more useful than from .c files.  However, nowadays even I am not very
convinced that that is a very fruitful use of time, since many/most
developers use ccache which will reduce the compile times anyway in many
cases; and development machines are typically much faster than ten years
ago.

Also, I think addition of new include lines to existing .c files should
be a point worth specific attention in patch review, to avoid breaking
reasonable modularity boundaries unnecessarily.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to retain lesser paths at add_path()?
Next
From: Andres Freund
Date:
Subject: Re: partition routing layering in nodeModifyTable.c