Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Collapse unexpanded macro definitions (rpm-software-management#1198)
Since the body of a newly defined macro may span multiple lines and contain %if expressions, we need to make sure the line parser does not try to interpret those when the corresponding %define or %global macro appears in a false %if branch and is therefore left unexpanded in the line buffer. This is usually not a problem since any macros found in the body itself would not be expanded anyway, but it can break the syntax check for conditionals, which follows after expansion. This is because, with the recently introduced support for line-continuation markers in %if expressions (commit 5f4fdce), the parser would be tricked into thinking that the markers belong to the %if expression itself and collapse them into a single line, including the matching %endif, and then complain about the missing %endif (which must be on a separate line). Instead, similarly to %if, we should collapse the %define/%global macro itself so that the line parser doesn't pass through the body at all. A side effect of this change (of commit 5f4fdce from a year ago, in fact) is that %if constructs are no longer syntax-checked within macros defined in false %if branches, but that's arguably correct behavior, since they only come into existence when their definition macro (%define or %global) is actually expanded, and should merely be treated as text values until that point. Fixes: rpm-software-management#1198
- Loading branch information