Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Andres Freund
Hi, On 2024-02-12 16:46:55 -0500, Tom Lane wrote: > Peter Eisentraut 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 > >

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Tom Lane
Peter Eisentraut 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

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Alvaro Herrera
On 2024-Feb-10, Peter Eisentraut wrote: > So as a test, I ran IWYU over the backend *.c files and removed all the > #includes it suggested. (Note that IWYU also suggests to *add* a bunch of > #includes, in fact that is its main purpose; I didn't do this here.) In some > cases, a more specific

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Andres Freund
Hi, On 2024-02-10 08:40:43 +0100, Peter Eisentraut wrote: > So as a test, I ran IWYU over the backend *.c files and removed all the > #includes it suggested. (Note that IWYU also suggests to *add* a bunch of > #includes, in fact that is its main purpose; I didn't do this here.) In some > cases,

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Tristan Partin
On Sat Feb 10, 2024 at 1:40 AM CST, Peter Eisentraut wrote: I played with include-what-you-use (IWYU), "a tool for use with clang to analyze #includes in C and C++ source files".[0] I came across this via clangd (the language server), because clangd (via the editor) kept suggesting a bunch of

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Nathan Bossart
On Mon, Feb 12, 2024 at 05:08:40PM +0100, Peter Eisentraut wrote: > On 10.02.24 21:13, Nathan Bossart wrote: >> I haven't played with it at all, but the topic reminds me of this thread: >> >> >> https://postgr.es/m/flat/CALDaNm1B9naPDTm3ox1m_yZvOm3KA5S4kZQSWWAeLHAQ%3D3gV1Q%40mail.gmail.com

Re: backend *.c #include cleanup (IWYU)

2024-02-12 Thread Peter Eisentraut
On 10.02.24 21:13, Nathan Bossart wrote: (Interestingly, IWYU has been mentioned in src/tools/pginclude/README since 2012. Has anyone else played with it? Was it not mature enough back then?) I haven't played with it at all, but the topic reminds me of this thread:

Re: backend *.c #include cleanup (IWYU)

2024-02-10 Thread Nathan Bossart
On Sat, Feb 10, 2024 at 08:40:43AM +0100, Peter Eisentraut wrote: > The purpose of this patch is twofold: One, it's of course a nice cleanup. > Two, this is a test how well IWYU might work for us. If we find either by > human interpretation that a change doesn't make sense, or something breaks >