Warn when whitespace is missing before macro body
This will now issue a warning when macro definition is possibly incorrect or ambigous, such as the one found in FC18 lvm2.spec: %define util-linux_version 2.22.1 warning: Macro %util needs whitespace before body Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
This commit is contained in:
parent
29e7c4b3bd
commit
0eb0da9af9
|
@ -515,6 +515,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
|
|||
char *b, *be, *ebody = NULL;
|
||||
int c;
|
||||
int oc = ')';
|
||||
const char *sbody; /* as-is body start */
|
||||
|
||||
/* Copy name */
|
||||
COPYNAME(ne, s, c);
|
||||
|
@ -530,6 +531,7 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
|
|||
|
||||
/* Copy body, skipping over escaped newlines */
|
||||
b = be = oe + 1;
|
||||
sbody = s;
|
||||
SKIPBLANK(s, c);
|
||||
if (c == '{') { /* XXX permit silent {...} grouping */
|
||||
if ((se = matchchar(s, c, '}')) == NULL) {
|
||||
|
@ -606,6 +608,9 @@ doDefine(MacroBuf mb, const char * se, int level, int expandbody)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (!isblank(*sbody) && !(*sbody == '\\' && iseol(sbody[1])))
|
||||
rpmlog(RPMLOG_WARNING, _("Macro %%%s needs whitespace before body\n"), n);
|
||||
|
||||
if (expandbody) {
|
||||
if (expandThis(mb, b, 0, &ebody)) {
|
||||
rpmlog(RPMLOG_ERR, _("Macro %%%s failed to expand\n"), n);
|
||||
|
|
Loading…
Reference in New Issue