aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2021-03-24 10:46:45 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2021-03-24 10:46:45 -0700
commit5368e4579403daaf6c12165eb857893f8acfc7f8 (patch)
tree2dc29fc2698ec3acc82362f83d901177fd35cf02
parent6d95cc8d296862b67dd7d9fd94c676065b202c1d (diff)
downloadnasm-5368e4579403daaf6c12165eb857893f8acfc7f8.tar.gz
nasm-5368e4579403daaf6c12165eb857893f8acfc7f8.tar.xz
nasm-5368e4579403daaf6c12165eb857893f8acfc7f8.zip
preproc: fix pasting of TOKEN_HERE, TOKEN_BASE and TOKEN_QMARKHEADmaster
Make the pasting behavior of TOKEN_QMARK, TOKEN_HERE and TOKEN_BASE match the NASM 2.15 behavior: ? is a keyword and pastes as an ID, $ and $$ are treated as operators (which doesn't seem to make much sense, but it is the current legacy behavior.) Reported-by: C. Masloch <pushbx@ulukai.org> Bugzilla: https://bugzilla.nasm.us/show_bug.cgi?id=3392733 Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--asm/preproc.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index ab229c9c..d1b9b31b 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2020 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2021 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -1478,7 +1478,7 @@ static Token *tokenize(const char *line)
p++;
} else if (nasm_isidstart(*p) || (*p == '$' && nasm_isidstart(p[1]))) {
/*
- * A regular identifier. This includes keywords, which are not
+ * A regular identifier. This includes keywords which are not
* special to the preprocessor.
*/
type = TOKEN_ID;
@@ -4907,7 +4907,8 @@ static inline bool pp_concat_match(const Token *t, enum concat_flags mask)
switch (t->type) {
case TOKEN_ID:
- ctype = CONCAT_ID; /* Ought this include $ and $$? */
+ case TOKEN_QMARK: /* Keyword, treated as ID for pasting */
+ ctype = CONCAT_ID;
break;
case TOKEN_LOCAL_MACRO:
ctype = CONCAT_LOCAL_MACRO;
@@ -4922,6 +4923,11 @@ static inline bool pp_concat_match(const Token *t, enum concat_flags mask)
case TOKEN_FLOAT:
ctype = CONCAT_NUM;
break;
+ case TOKEN_HERE:
+ case TOKEN_BASE:
+ /* NASM 2.15 treats these as operators, but is that sane? */
+ ctype = CONCAT_OP;
+ break;
case TOKEN_OTHER:
ctype = CONCAT_OP; /* For historical reasons */
break;