[Rpm-maint] [rpm-software-management/rpm] Warn if %else is after %else (#649)
Panu Matilainen
notifications at github.com
Fri May 17 10:40:30 UTC 2019
pmatilai commented on this pull request.
> @@ -462,6 +430,22 @@ int readLine(rpmSpec spec, int strip)
lineType = parseLineType(s);
if (!lineType)
goto after_classification;
+
+ /* check ordering of the conditional */
+ if (lineType->isConditional &&
+ (spec->readStack->lastConditional->id & lineType->wrongPrecursors)) {
+ /* the conditional can't be after %endif or the 1. conditional */
+ if (spec->readStack->lastConditional->id == LINE_ENDIF)
+ rpmlog(RPMLOG_ERR,_("%s:%d: %s with no %%if\n"),
+ ofi->fileName, ofi->lineNum, lineType->text);
+ else
+ /* wrong ordering of the last two conditionals */
+ rpmlog(RPMLOG_ERR,_("%s:%d: %s after %s\n"),
Both the if-block and else-block consist of multiple physical lines, do use { } blocks in these cases to make it clearer. Also the /* wrong ordering */ comment is on odd indentation level here.
--
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/649#pullrequestreview-238855898
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20190517/674b5735/attachment.html>
More information about the Rpm-maint
mailing list