Re: PATCH] remove duplicate #include directives
- From
René Scharfe <l.s.r@web.de>
- Date
- Oct 6, 2019, 10:16 UTC
- Message-ID
- <5af3ad29-5127-b5f7-46c9-f1d3d45b4e67@web.de>
- In-Reply-To
- <xmqqv9t269qk.fsf@gitster-ct.c.googlers.com>
Am 06.10.19 um 01:41 schrieb Junio C Hamano:
Show 13 quoted lines
> René Scharfe <l.s.r@web.de> writes: >> This one here requires one more piece of information, though, namely our >> convention of wrapping header files in guard defines to make repeated >> includes of them no-ops. We do that for those removed by the patch, but >> we have a few exceptions to that rule in our repo (at least >> command-list.h, kwset.h, sha1dc_git.h, tar.h, unicode-width.h). So in >> that sense it's not such a good example of a self-sufficient patch. :) > > Not really. "We use header guards" is an argument that demotes this > cleanup from "must have" to "nice to have". If a project did not > use header guards or including the same header twice were an error, > the patch in question would have been more necessary, but that > wouldn't have changed the correctness of the patch, I think.
You start with "No", but make my point -- a reader would need more information than the content of the patch itself to classify it as a trivial cleanup, namely knowledge of our use of include guards.
Here is an example of a non-idempotent header:
#define NDEBUG ... #include <assert.h> ... #undef NDEBUG ... #include <assert.h>
(That's the only one we use that I'm aware of.)
René