git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH v2 2/2] headers: include dependent headers

From
David Aguilar <davvid@gmail.com>
Date
Sep 7, 2014, 20:30 UTC
Message-ID
<20140907203049.GA61326@gmail.com>
In-Reply-To
<20140907194917.GB1611@google.com>
On Sun, Sep 07, 2014 at 12:49:18PM -0700, Jonathan Nieder wrote:
Show 34 quoted lines
> David Aguilar wrote:
> 
> > Add dependent headers so that including a header does not
> > require including additional headers.
> 
> I agree with this goal, modulo the compat-util.h caveat.  Thanks
> for working on it.
> 
> [...]
> > --- a/archive.h
> > +++ b/archive.h
> > @@ -1,6 +1,7 @@
> >  #ifndef ARCHIVE_H
> >  #define ARCHIVE_H
> >  
> > +#include "cache.h"
> >  #include "pathspec.h"
> >  
> >  struct archiver_args {
> 
> I'm less happy about the way of achieving that goal.  Here's an
> alternative.  Advantages:
> 
>  * (fully expanded) headers stay small
> 
>  * fewer other headers included as a side-effect of including one
>    header, so callers are more likely to remember to #include the
>    headers defining things they need (which makes later refactoring
>    easier)
> 
>  * circular header dependencies are harder to produce
> 
> If this seems like a good direction to go in, I can finish the patch
> later today
Yes, please, that would be sweet.

Would you mind squashing in your sug to patch 1/2 as well when resending? It seems like a nice improvement all around.

RE: pre-compiled headers -- that might be a nice follow-up to
this series. I'm not very familiar with Windows so I don't know
if it would be doable on mingw, cygwin, and msvc et al. but if
it helps other platforms then it could be a nice feature.
Thanks Jonathan,
-- 
David
Previous: Jonathan NiederNext: Jonathan Nieder
Message 7 of 14 in “Makefile: add check-headers target”
  1. 1/2 Makefile: add check-headers targetDavid Aguilar, Sep 7, 2014
  2. 2/2 headers: include dependent headersDavid Aguilar, Sep 7, 2014
  3. René ScharfeSep 7, 2014
  4. Jonathan NiederSep 7, 2014
  5. Johannes SixtSep 7, 2014
  6. Jonathan NiederSep 7, 2014
  7. David AguilarSep 7, 2014
  8. Jonathan NiederSep 7, 2014
  9. Junio C HamanoSep 8, 2014
  10. Matthieu MoySep 8, 2014
  11. Junio C HamanoSep 8, 2014
  12. David AguilarSep 10, 2014
  13. Junio C HamanoSep 10, 2014
  14. Matthieu MoySep 10, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.