[nasm:nasm-2.16.xx] preproc: fix the parameter number in error messages

nasm-bot for H. Peter Anvin hpa at zytor.com
Fri Oct 13 17:24:03 PDT 2023


Commit-ID:  e2dc551796071cfaed2037e04857799c3f79442d
Gitweb:     http://repo.or.cz/w/nasm.git?a=commitdiff;h=e2dc551796071cfaed2037e04857799c3f79442d
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 13 Oct 2023 17:21:12 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 13 Oct 2023 17:21:12 -0700

preproc: fix the parameter number in error messages

The user would generally expect the parameter number to be counted
from 1 for human purposes, and that is also consistent with %1, %2,
... for multi-line macros.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 asm/preproc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/asm/preproc.c b/asm/preproc.c
index 055f18b8..0e0195ee 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 1996-2022 The NASM Authors - All Rights Reserved
+ *   Copyright 1996-2023 The NASM Authors - All Rights Reserved
  *   See the file AUTHORS included with the NASM distribution for
  *   the specific copyright holders.
  *
@@ -5919,10 +5919,10 @@ static SMacro *expand_one_smacro(Token ***tpp)
                     /* Nothing meaningful to do */
                 } else if (tokval.t_type) {
                     nasm_nonfatal("invalid expression in parameter %d of %s `%s'",
-                                  i, mtype, m->name);
+                                  i+1, mtype, m->name);
                 } else if (!is_simple(evalresult)) {
                     nasm_nonfatal("non-constant expression in parameter %d of %s `%s'",
-                                  i, mtype, m->name);
+                                  i+1, mtype, m->name);
                 } else {
                     params[i] = make_tok_num(NULL, reloc_value(evalresult));
                 }


More information about the Nasm-commits mailing list