summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-10-07 19:30:54 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-10-27 21:41:35 +0400
commit0457bcbf2e97a822cd6635e1e50c89172ad19a2c (patch)
tree502247fc7ed70d665f5b938c1f65feae0cf44122
parent582b3d0c70586ef088b3b48529173ffd573c051a (diff)
downloadnasm-0457bcbf2e97a822cd6635e1e50c89172ad19a2c.tar.gz
preproc: Issue warning on unterminated %{ construct
As being pointed by "matching braces" topic on [ http://forum.nasm.us/index.php?topic=905.0 ] we don't issue warning on missed match for "{" brace opened. Strictly speaking we should issue error instead and force user to fix asm source code but since it's here for a long time already -- lets be "admissive". Reported-by: Klod CC: Frank Kotler <fbkotler@zytor.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--preproc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/preproc.c b/preproc.c
index 19de89e9..af466637 100644
--- a/preproc.c
+++ b/preproc.c
@@ -907,10 +907,14 @@ static Token *tokenize(char *line)
type = TOK_PREPROC_ID;
} else if (*p == '{') {
p++;
- while (*p && *p != '}') {
+ while (*p) {
+ if (*p == '}')
+ break;
p[-1] = *p;
p++;
}
+ if (*p != '}')
+ error(ERR_WARNING | ERR_PASS1, "unterminated %{ construct");
p[-1] = '\0';
if (*p)
p++;