New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement %elif #710
Implement %elif #710
Conversation
build/parseSpec.c
Outdated
after_classification: | ||
if (match != -1) { | ||
if (lineType->id & (LINE_IF | LINE_IFARCH | LINE_IFNARCH | LINE_IFOS | | ||
LINE_IFNOS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calls for a bitmask, something like LINE_IFANY, which can be used to trap all the types with one symbol. Makes the line shorter and more readable. (fwiw no I'm not reviewing, just taking a look)
Panu's comments are incorporated. |
build/parseSpec.c
Outdated
rl->lastConditional = lineType; | ||
spec->readStack = rl; | ||
spec->line[0] = '\0'; | ||
} else if (lineType->id & (LINE_ELIF | LINE_ELIFARCH | LINE_ELIFOS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The various ELIF's are another candidate for a bit mask, this set is repeated at least twice in the patch (used earlier in the "dont expand in false branch" check). In general, when addressing something, it pays to look for similar cases/opportunities/bugs, they're quite often there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is changed in the new version.
No functional change, preparation for %elif.
No functional change
informative The original message like e.g.: error: /data/rpmbuild/SPECS/iftest.spec:8: bad %if condition is changed to error: /data/rpmbuild/SPECS/iftest.spec:8: Bad %if condition: nonsense-3 Preparation for %elif.
There may be several %elifs within the same %if statement. They must be placed after %if and before %endif and %else (if %else is contained). The first %elif expression (if any) that evaluates to TRUE would be executed. In scope of %if you can use any of the new operators - %elif, %elifarch, %elifos. Similarly for %ifos, %ifnos, %ifarch and %ifnarch. The expression after %elif (resp. %elifos or %elifarch) is expandedd iff the expression can influence the execution of the %elif branch. E.g.: an %elif expression after the first %elif expression that evaluates to TRUE is not expanded.
Corrected the commit message of the first commit. |
Ok, Rebased and merged. |
No description provided.