[nasm:master] preproc: add warning for empty %{} construct
nasm-bot for H. Peter Anvin
hpa at zytor.com
Mon Nov 7 17:12:38 PST 2022
Commit-ID: 7b8cd67d5165320cf95fa6906654751a30817c96
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7b8cd67d5165320cf95fa6906654751a30817c96
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 7 Nov 2022 12:01:00 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 7 Nov 2022 12:01:00 -0800
preproc: add warning for empty %{} construct
An empty %{} becomes % which is simply the arithmetic
operator. Although that is consistent, it might be surprising for
users, to issue a warning.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
asm/preproc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/asm/preproc.c b/asm/preproc.c
index a016fda4..99218250 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -1397,6 +1397,9 @@ static Token *tokenize(const char *line)
/* Classify here, to handle %{...} correctly */
if (toklen < 2) {
type = '%'; /* % operator */
+ if (unlikely(*line == '{')) {
+ nasm_warn(WARN_OTHER, "empty %%{} construct treated like the %% arithmetric operator");
+ }
} else {
char c0 = line[1];
More information about the Nasm-commits
mailing list