[Rpm-maint] [rpm-software-management/rpm] Unclosed %if (when defined inside %define) (#1198)

Michal Domonkos notifications at github.com
Tue Aug 25 11:43:41 UTC 2020


> Eliminating ambiguity (which is _always_ buggy from somebody's perspective) is usually worth a fair amount of disruption in the end, and messy is in the eye of the beholder.
> 
> ```
> %define test() \
> %if 1\
> BUG\
> %endif\
> %{nil}
> ```
> 
> It's not that obvious whether the %if is meant for the spec parser inline, or whether it's meant to be part of the macro body.

Is that a question for the parser or for the person reading the code?

If the former, that's not really the case, as it's unambiguously part of the macro body, due to the line-continuation marker(s) preceding it. By "collapsing" the `%define` the whole body becomes one line and the parser continues past it.

If the latter, totally agree. But I think this is the case with any other language as well; whenever you manually line-break statements, consider e.g. a long `if` expression in C. It's more about the "code culture" at that point. For specs, it's not usual to indent stuff, but that probably has to do with insufficient support for that (is that still the case, btw?).



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1198#issuecomment-679974112
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200825/b1b54a71/attachment-0001.html>


More information about the Rpm-maint mailing list