Refactoring patches

Yuriy Skalko yuriy.skalko at gmail.com
Wed Oct 14 12:43:40 UTC 2020


> If we are going after redundant includes we should first decide what's
> the goal and why we are doing it.
> 
> Are we trying to make it
> 
> - "semantically correct", by which I mean removing includes unrelated to
>    the content of the processed file (i.e. forgotten header which is no
>    more used becase the code using it is gone). 
>    Having "unnecessary" include whose content is used (but already included
>    recursively via another include) is actually proper.
> 
> - just trying to speedup things, so any possible include gone is good.


> I don't have strong opinions about the direction, but I think we should first 
> agree
> what we are trying to achieve here.
> 
> Pavel

My main point for preparing the patch was achieving the first goal --
semantic correctness.

Every source file should include only headers with declarations it is
using. And not to depend on transitive (or recursive as you called)
includes since they are fragile and not reliable.

Also goals are to remove duplicated includes and to leave only one
include of some header for any "C++ module" (source + matching header).
Of course real (C++20) modules will not be available in near future.

Yuriy


More information about the lyx-devel mailing list