Make builtin macros honor generic macro conditionals

This commit is contained in:
Panu Matilainen 2020-11-04 11:24:56 +02:00
parent 1d83ec55d6
commit ea6431c521
1 changed files with 19 additions and 19 deletions

View File

@ -1508,25 +1508,6 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
}
}
/* Expand builtin macros */
if (me && (me->flags & ME_BUILTIN)) {
int havearg = (me->flags & ME_HAVEARG) ? 1 : 0;
if (havearg != (g != NULL)) {
mbErr(mb, 1, "%%%s: %s\n", me->name, havearg ?
_("argument expected") : _("unexpected argument"));
continue;
}
if (me->flags & ME_PARSE) {
parseFunc parse = me->func;
s = parse(mb, me, se);
} else {
macroFunc func = me->func;
func(mb, me, g, gn);
s = se;
}
continue;
}
/* XXX Special processing for flags and existance test */
if (*f == '-' || chkexist) {
if ((me == NULL && !negate) || /* Without existance, skip %{?...} */
@ -1551,6 +1532,25 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
continue;
}
/* Expand builtin macros */
if (me->flags & ME_BUILTIN) {
int havearg = (me->flags & ME_HAVEARG) ? 1 : 0;
if (havearg != (g != NULL)) {
mbErr(mb, 1, "%%%s: %s\n", me->name, havearg ?
_("argument expected") : _("unexpected argument"));
continue;
}
if (me->flags & ME_PARSE) {
parseFunc parse = me->func;
s = parse(mb, me, se);
} else {
macroFunc func = me->func;
func(mb, me, g, gn);
s = se;
}
continue;
}
/* Grab args for parametric macros */
ARGV_t args = NULL;
if (me->opts != NULL) {