Re: [PATCH] help: ensure that common-cmds.h is only included by help.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 13, 2014 at 10:23:03PM -0700, Junio C Hamano wrote:
> On Sat, Sep 13, 2014 at 7:00 PM, Perry Hutchison <perryh@xxxxxxxxxxxxxx> wrote:
> > David Aguilar <davvid@xxxxxxxxx> wrote:
> >> Add a #ifndef guard to ensure that common-cmds.h can only
> >> be included by help.c.
> >
> > This strikes me as a very peculiar, and sub-optimal, way of
> > achieving the purpose.  If these definitions are intended to
> > be private to help.c, why not put them there and eliminate
> > common-cmds.h entirely?
> 
> Have you studied where common-cmds.h comes from?
> After you have done so, would you make the same suggestion?
> 
> Having said that, I also do not think this is such a good idea.
> Wouldn't the new "check" script added in this series a better
> place? For example, it may want to make sure that git-compat-util.h
> (or a couple of its equivalents) is the first file included in any mainline
> C source file, and such an inclusion is done unconditionally.
> 
> Which would mean that the checker would scan *.c files with grep
> or a Perl script. It would be trivial to enforce "nobody other than these
> small selected C files is allowed to include common-cmds.h" rule.

Good idea. I implemented this check and the tweaks to make it
pass are small and focused. I'll send these patches shortly.

> Regarding the other patch that butchers many *.h files, I am not
> still very enthused. Including cache.h at the beginning of branch.h,
> for example, would mean git-compat-util.h ends up included at the
> beginning of branch.h.

I can look into Jonathan's forward-decl approach later too.
That'll probably result in less of a butchering.
-- 
David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]