Re: backend *.c #include cleanup (IWYU) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: backend *.c #include cleanup (IWYU)
Date
Msg-id 2356244.1707774415@sss.pgh.pa.us
Whole thread Raw
In response to Re: backend *.c #include cleanup (IWYU)  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: backend *.c #include cleanup (IWYU)
List pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> Approaches like that as well as the in-tree pgrminclude work by "I 
> removed the #include and it still compiled fine", which can be 
> unreliable.  IWYU on the other hand has the compiler tracking where a 
> symbol actually came from, and so if it says that an #include is not 
> used, then it's pretty much correct by definition.

Well, it might be correct by definition for the version of the code
that the compiler processed.  But it sounds to me like it's just as
vulnerable as pgrminclude to taking out #includes that are needed
only by #ifdef'd code sections that you didn't compile.

On the whole, our experience with automated #include removal is
pretty awful.  I'm not sure I want to go there again.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Fix a typo in pg_rotate_logfile
Next
From: Pavel Luzanov
Date:
Subject: Re: Psql meta-command conninfo+