> c) %else if 0%{?rhel} >= 6
d) %else !use_embedded
Treating a text after %else as a part of the else-branch will improve a) and 
b), but it will not solve case c) and especially d). That is why I would prefer 
the warning in both cases.

Well, c) and d) would depend on context, but most likely they'd end up in 
syntax error, which is ok. Many languages treat text after else as part of the 
else branch. OTOH the closest relative to spec %if's would be the C 
pre-processor which simply warns: ```warning: extra tokens at end of #else 
directive ```
So perhaps that is the best option here afterall.

Looking at the macro expansion behavior, the current behavior is certainly very 
broken. Consider the following:
```
%if %{val}
%{echo:yeah}
%else %{echo:moo}
%{echo:nay}
%endif
```
"moo" gets echoed iff %{val} evaluates to *true*, which is just *crazy*. At 
this point I do have to agree with you that %else needs to be parsed before 
deciding whether to expand a line or not, and ditto %endif. And if we're adding 
a warning for text after %else, then perhaps neither of these lines should ever 
be expanded.

If parsing twice is unavoidable then it should at least use common code to do 
so, which might help make the %elif thing less ugly as well.

-- 
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/pull/625#issuecomment-460547721
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to