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

Re: [PATCH 8/8] hook-list.h: add a generated list of hooks, like config-list.h

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 15, 2021, 22:49 UTC
Message-ID
<211115.86bl2lqbbt.gmgdl@evledraar.gmail.com>
In-Reply-To
<20211115224015.vzfevpvptysxzpaa@glandium.org>
On Tue, Nov 16 2021, Mike Hommey wrote:
Show 29 quoted lines
> On Mon, Nov 15, 2021 at 11:26:36PM +0100, Ævar Arnfjörð Bjarmason wrote:
>> 
>> On Tue, Nov 16 2021, Mike Hommey wrote:
>> 
>> > On Thu, Sep 23, 2021 at 12:30:03PM +0200, Ævar Arnfjörð Bjarmason wrote:
>> >> -builtin/help.sp builtin/help.s builtin/help.o: config-list.h GIT-PREFIX
>> >> +hook.sp hook.s hook.o: hook-list.h
>> >> +
>> >> +builtin/help.sp builtin/help.s builtin/help.o: config-list.h hook-list.h GIT-PREFIX
>> >
>> > hook-list.h is only included from buitin/bugreport.c, so
>> > builtin/bugreport.o should be the one with the hook-list.h dependency,
>> > shouldn't it?
>> 
>> Well spotted, yes. This is a mistake. I think from some earlier WIP
>> version of the series.
>> 
>> In practice we don't really miss dependencies due to these sorts of
>> mistakes since we use the .depends files, i.e. GCC & Clang figure this
>> out for us:
>> 
>>     $ grep hook-list .depend/* */.depend/*
>>     builtin/.depend/bugreport.o.d: compat/compiler.h git-compat-util.h hook.h hook-list.h
>>     builtin/.depend/bugreport.o.d:hook-list.h:
>
> But aren't those .depends files are only created when compiling object
> files, such that builtin/.depend/bugreport.o.d wouldn't exist until
> bugreport.c is compiled, which would fail if hook-list.h wasn't created
> before that?
Fail how?

I don't think it could fail, because the purpose of these dependency relationships is to avoid needless *re*builds. So if you're building for the first time it doesn't matter, your compiler will find the relevant things to include for you. It doesn't need what's in the Makefile to do that.

See [1], what I said about LIB_H there applies more generally for the .depends files.

It will only fail in the sense that it over-depends, i.e. if you do:
    git clean -dxf; make builtin/help.o

We'll generate the hook list, as opposed to for buildin/add.o or whatever, but I'd say that generally doesn't matter all that much, what matters is that we don't miss dependency relationships.

Anyway, I'll try to loop around to fixing this, just wanted to gather some interest in the more general set of fixes I've got. I've got some fixes queued up after that that fix/improve the *.sp and *.s parts of the line you quoted (and other similar lines). I'd prefer just to fix this along with those so the two don't textually conflict.

1. https://lore.kernel.org/git/211110.86h7cki0uo.gmgdl@evledraar.gmail.com/
Previous: Mike HommeyNext: Mike Hommey
Message 21 of 39 in “Makefile: generate a hook-list.h, prep for config-based-hooks”
  1. 0/8 Makefile: generate a hook-list.h, prep for config-based-hooksÆvar Arnfjörð Bjarmason, Sep 23, 2021
  2. 1/8 Makefile: mark "check" target as .PHONYÆvar Arnfjörð Bjarmason, Sep 23, 2021
  3. 2/8 Makefile: stop hardcoding {command,config}-list.hÆvar Arnfjörð Bjarmason, Sep 23, 2021
  4. 3/8 Makefile: don't perform "mv $@+ $@" dance for $(GENERATED_H)Ævar Arnfjörð Bjarmason, Sep 23, 2021
  5. 4/8 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Sep 23, 2021
  6. 5/8 hook.[ch]: move find_hook() from run-command.c to hook.cÆvar Arnfjörð Bjarmason, Sep 23, 2021
  7. 6/8 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Sep 23, 2021
  8. 7/8 hook.c users: use "hook_exists()" instead of "find_hook()"Ævar Arnfjörð Bjarmason, Sep 23, 2021
  9. 8/8 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Sep 23, 2021
  10. Phillip WoodSep 24, 2021
  11. Junio C HamanoSep 24, 2021
  12. René ScharfeSep 24, 2021
  13. Ævar Arnfjörð BjarmasonSep 24, 2021
  14. René ScharfeSep 24, 2021
  15. Ævar Arnfjörð BjarmasonSep 24, 2021
  16. Phillip WoodSep 27, 2021
  17. Ævar Arnfjörð BjarmasonSep 27, 2021
  18. Mike HommeyNov 15, 2021
  19. Ævar Arnfjörð BjarmasonNov 15, 2021
  20. Mike HommeyNov 15, 2021
  21. Ævar Arnfjörð BjarmasonNov 15, 2021
  22. Mike HommeyNov 15, 2021
  23. Ævar Arnfjörð BjarmasonNov 16, 2021
  24. Junio C HamanoNov 17, 2021
  25. 0/8 Makefile: generate a hook-list.h, prep for config-based-hooksÆvar Arnfjörð Bjarmason, Sep 26, 2021
  26. 1/8 Makefile: mark "check" target as .PHONYÆvar Arnfjörð Bjarmason, Sep 26, 2021
  27. 2/8 Makefile: stop hardcoding {command,config}-list.hÆvar Arnfjörð Bjarmason, Sep 26, 2021
  28. 3/8 Makefile: don't perform "mv $@+ $@" dance for $(GENERATED_H)Ævar Arnfjörð Bjarmason, Sep 26, 2021
  29. 4/8 Makefile: remove an out-of-date commentÆvar Arnfjörð Bjarmason, Sep 26, 2021
  30. 5/8 hook.[ch]: move find_hook() from run-command.c to hook.cÆvar Arnfjörð Bjarmason, Sep 26, 2021
  31. 6/8 hook.c: add a hook_exists() wrapper and use it in bugreport.cÆvar Arnfjörð Bjarmason, Sep 26, 2021
  32. 7/8 hook.c users: use "hook_exists()" instead of "find_hook()"Ævar Arnfjörð Bjarmason, Sep 26, 2021
  33. 8/8 hook-list.h: add a generated list of hooks, like config-list.hÆvar Arnfjörð Bjarmason, Sep 26, 2021
  34. Junio C HamanoSep 27, 2021
  35. René ScharfeSep 27, 2021
  36. Junio C HamanoSep 27, 2021
  37. Phillip WoodSep 27, 2021
  38. Ævar Arnfjörð BjarmasonSep 27, 2021
  39. Phillip WoodSep 27, 2021

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.