Issue a warning when passing arguments to non-parametric macros
This should be an error for consistency with other macro argument checking but as there appear to be usages in the wild, make it a warning for now. Fixes: #2932
This commit is contained in:
parent
5ace145d40
commit
8de699ee70
|
@ -1716,6 +1716,12 @@ expandMacro(rpmMacroBuf mb, const char *src, size_t slen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me->opts == NULL && !(me->flags & ME_FUNC)) {
|
if (me->opts == NULL && !(me->flags & ME_FUNC)) {
|
||||||
|
if (g || (lastc && *lastc == '}')) {
|
||||||
|
/* XXX TODO: Make this an error in a few years */
|
||||||
|
rpmMacroBufErr(mb, 0,
|
||||||
|
_("unexpected argument to non-parametric macro %%%s\n"),
|
||||||
|
me->name);
|
||||||
|
}
|
||||||
/* Simple non-parametric macro */
|
/* Simple non-parametric macro */
|
||||||
doMacro(mb, me, NULL, NULL);
|
doMacro(mb, me, NULL, NULL);
|
||||||
s = se;
|
s = se;
|
||||||
|
|
|
@ -454,6 +454,27 @@ runroot rpm \
|
||||||
0
|
0
|
||||||
0
|
0
|
||||||
])
|
])
|
||||||
|
|
||||||
|
RPMTEST_CHECK([
|
||||||
|
runroot rpm \
|
||||||
|
--define 'zzz xxx' \
|
||||||
|
--eval '%zzz' \
|
||||||
|
--eval '%{zzz}' \
|
||||||
|
--eval '%{zzz:}' \
|
||||||
|
--eval '%{zzz }' \
|
||||||
|
--eval '%{zzz aa}'
|
||||||
|
],
|
||||||
|
[0],
|
||||||
|
[xxx
|
||||||
|
xxx
|
||||||
|
xxx
|
||||||
|
xxx
|
||||||
|
xxx
|
||||||
|
],
|
||||||
|
[warning: unexpected argument to non-parametric macro %zzz
|
||||||
|
warning: unexpected argument to non-parametric macro %zzz
|
||||||
|
warning: unexpected argument to non-parametric macro %zzz
|
||||||
|
])
|
||||||
RPMTEST_CLEANUP
|
RPMTEST_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([string functions])
|
AT_SETUP([string functions])
|
||||||
|
|
Loading…
Reference in New Issue