Re: [PATCH] Makefile(s): avoid recipe prefix in conditional statements

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

 



On Mon, Apr 08, 2024 at 08:04:14PM -0400, Jeff King wrote:

> I do find it curious that in:
> 
> ifdef FOO
> 	SOME_VAR += bar
> endif
> 
> the tab is significant for "ifdef" but not for SOME_VAR (at least that
> is implied by Taylor's patch, which does not touch the bodies within the
> conditionals).
> 
> I may just be showing my ignorance of the parsing issue, though. For
> anybody else digging into the details, I think the correct link is:
> 
>   https://savannah.gnu.org/bugs/index.php?64185
> 
> (the commit has the wrong bug number, 64815).

Answering my own question (at least what I think the answer is): there's
basically two levels of parsing going on. The outer layer is respecting
conditionals to decide which lines to care about at all, and the inner
one is figuring what are assignments, rules, recipes, etc.

So the outer parser cares about things that look like conditionals, but
nothing else. The inner one has more context and can more easily realize
that "\tSOME_VAR += bar" is not part of a recipe.

I'd guess it's _possible_ to fix the case discussed in the bug by
letting the outer parser know more of the inner-parser context (i.e.,
whatever rules it uses to decide that the assignment line is not a
recipe line could similarly be used for a line like "\telse"). But I
also wouldn't be at all surprised if it would involve a substantial
rewrite.  At any rate, I'd certainly defer to you on such matters. I'm
mostly just thinking out loud from my peanut-gallery perspective.

-Peff




[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]

  Powered by Linux