preproc: error on unterminated %[...]
authorH. Peter Anvin <hpa@zytor.com>
Mon, 20 Oct 2008 05:14:30 +0000 (22:14 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Mon, 20 Oct 2008 05:14:30 +0000 (22:14 -0700)
Make unterminated %[...] constructs an error.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
preproc.c

index 0b7ec1c86669e028fafbfaaeca749ca6f5fb83e0..253244ca8e19b6d145eb36d8c15bcd8af59118af 100644 (file)
--- a/preproc.c
+++ b/preproc.c
@@ -831,6 +831,8 @@ static Token *tokenize(char *line)
                p--;
                if (*p)
                    *p++ = '\0';
+               if (lvl)
+                   error(ERR_NONFATAL, "unterminated %[ construct");
                type = TOK_INDIRECT;
            } else if (*p == '?') {
                type = TOK_PREPROC_Q; /* %? */