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

Re: [PATCH] Makefile: make COMPUTE_HEADER_DEPENDENCIES=auto work with DEVOPTS=pedantic

From
Carlo Arenas <carenas@gmail.com>
Date
Sep 22, 2021, 20:36 UTC
Message-ID
<CAPUEspi5B8gQ5XVsgkAFDDrkE+Uo__9dzFm7UTZzCZUeExA=8w@mail.gmail.com>
In-Reply-To
<YUuPYDkxjDIvIfwI@coredump.intra.peff.net>
On Wed, Sep 22, 2021 at 1:17 PM Jeff King <peff@peff.net> wrote:
Show 25 quoted lines
>
> On Wed, Sep 22, 2021 at 11:28:38AM -0700, Junio C Hamano wrote:
>
> > >  ifeq ($(COMPUTE_HEADER_DEPENDENCIES),auto)
> > > -dep_check = $(shell $(CC) $(ALL_CFLAGS) \
> > > +dep_check = $(shell $(CC) \
> > >     -c -MF /dev/null -MQ /dev/null -MMD -MP \
> > >     -x c /dev/null -o /dev/null 2>&1; \
> > >     echo $$?)
> >
> > I am all for this simplification.  It takes us back to the state
> > before 1816bf26 (Makefile: Improve compiler header dependency check,
> > 2011-08-30).  But I think that is more or less orthogonal to the
> > "you are not supposed to feed an empty compilation unit" issue.
>
> Hmm, my suggestion was off the cuff without digging to see whether we
> used to do something similar. ;)
>
> I do worry a bit that we'd be regressing the case that commit tried to
> fix. OTOH, I'm not sure I understand its commit message. It talks about
> things in CFLAGS being a problem, but it looks like the original (and my
> proposal here) would not look at CFLAGS at all? If people are putting
> stuff into CC that will break when used without CFLAGS, then I feel like
> the answer might be "don't do that". Or are there common situations
> where $(CC) is not expected to behave sensibly on its own?

Yes, the problem was ONLY with the gcc that came in macOS before they moved to clang and that had a frankenstein set of options which will prevent people building BOTH fat binaries and doing this header dependency computation at the same time.

Ironically, modern clang makes his use case even uglier (running on top of Ævar's fix) :

$ make CFLAGS="-arch x86_64 -arch arm64" fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't create temporary output file: /dev/null.lipo (Operation not permitted) clang: error: lipo command failed with exit code 1 (use -v to see invocation) fatal error: /Library/Developer/CommandLineTools/usr/bin/lipo: can't create temporary output file: /dev/null.lipo (Operation not permitted) clang: error: lipo command failed with exit code 1 (use -v to see invocation) Non-zero 1 exit with COMPUTE_HEADER_DEPENDENCIES=auto, set it to "yes" or "no" t

so the test fails, and COMPUTE_HEADER_DEPENDENCIES is disabled, but it shouldn't and works fine if the test is overridden with COMPUTE_HEADER_DEPENDENCIES=yes

so by removing the CFLAGS from that test, we will actually be fixing this use case as well IMHO.

Carlo
Previous: Jeff KingNext: Ævar Arnfjörð Bjarmason
Message 9 of 21 in “Makefile: make COMPUTE_HEADER_DEPENDENCIES=auto work with DEVOPTS=pedantic”
  1. Makefile: make COMPUTE_HEADER_DEPENDENCIES=auto work with DEVOPTS=pedanticÆvar Arnfjörð Bjarmason, Sep 22, 2021
  2. Carlo ArenasSep 22, 2021
  3. Ævar Arnfjörð BjarmasonSep 22, 2021
  4. Junio C HamanoSep 22, 2021
  5. Jeff KingSep 22, 2021
  6. Junio C HamanoSep 22, 2021
  7. Carlo ArenasSep 22, 2021
  8. Jeff KingSep 22, 2021
  9. Carlo ArenasSep 22, 2021
  10. Ævar Arnfjörð BjarmasonSep 22, 2021
  11. Jeff KingSep 23, 2021
  12. Junio C HamanoSep 23, 2021
  13. Jeff KingSep 23, 2021
  14. Junio C HamanoSep 23, 2021
  15. Ævar Arnfjörð BjarmasonSep 22, 2021
  16. 0/2 Makefile: "pedantic" fallout on .depend and "compdb"Ævar Arnfjörð Bjarmason, Sep 22, 2021
  17. 1/2 Makefile: make COMPUTE_HEADER_DEPENDENCIES=auto work with DEVOPTS=pedanticÆvar Arnfjörð Bjarmason, Sep 22, 2021
  18. 2/2 Makefile: pass -Wno-pendantic under GENERATE_COMPILATION_DATABASE=yesÆvar Arnfjörð Bjarmason, Sep 22, 2021
  19. Carlo ArenasSep 23, 2021
  20. Junio C HamanoSep 23, 2021
  21. Jeff KingSep 23, 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.