[Nasm-bugs] [Bug 3392567] [Feature request] Listing preprocessor define results in list file
noreply-nasm at gorcunov.org
noreply-nasm at gorcunov.org
Thu Jun 6 07:52:52 PDT 2019
https://bugzilla.nasm.us/show_bug.cgi?id=3392567
C. Masloch <pushbx at 38.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pushbx at 38.de
--- Comment #1 from C. Masloch <pushbx at 38.de> ---
I prepared a patch for this, adding a debug message to preproc.c:define_smacro.
EQU isn't really needed because those end up in the map file.
$ ./nasm -v
NASM version 2.15rc0 compiled on Jun 6 2019
$ cat test.asm
%define foo bar
%assign quux 26
%defstr baz xyzzy
__SECT__
%iassign boo -1
%define foobar(a,b) (a + b)
$ ./nasm test.asm -o test.bin -l test.lst && cat test.lst
0 ****************** expansion: __FILE__ =
0 ****************** expansion: __LINE__ =
0 ****************** expansion: __BITS__ =
0 ****************** expansion: __PTR__ =
0 ****************** expansion: __PASS__ = 2
0 ****************** expansion: __SECT__ =
0 ****************** expansion:
__SECTALIGN_ALIGN_UPDATES_SECTION__ = 1
0 ****************** expansion: __FLOAT_DAZ__ = nodaz
0 ****************** expansion: __FLOAT_ROUND__ = near
0 ****************** expansion: __FLOAT__ =
__FLOAT_DAZ__,__FLOAT_ROUND__
0 ****************** expansion: __NASM_MAJOR__ = 2
0 ****************** expansion: __NASM_MINOR__ = 14
0 ****************** expansion: __NASM_SUBMINOR__ = 99
0 ****************** expansion: __NASM_PATCHLEVEL__ = 90
0 ****************** expansion: __NASM_VERSION_ID__ =
0020E635Ah
0 ****************** expansion: __NASM_VER__ = "2.15rc0"
0 ****************** expansion: __SECT__ = [section .text]
0 ****************** expansion: __DATE__ = "2019-06-06"
0 ****************** expansion: __DATE_NUM__ = 20190606
0 ****************** expansion: __TIME__ = "16:50:21"
0 ****************** expansion: __TIME_NUM__ = 165021
0 ****************** expansion: __UTC_DATE__ = "2019-06-06"
0 ****************** expansion: __UTC_DATE_NUM__ = 20190606
0 ****************** expansion: __UTC_TIME__ = "14:50:21"
0 ****************** expansion: __UTC_TIME_NUM__ = 145021
0 ****************** expansion: __POSIX_TIME__ = 1559832621
0 ****************** expansion: __OUTPUT_FORMAT__ = bin
1 %define foo bar
1 ****************** expansion: foo = bar
2 %assign quux 26
2 ****************** expansion: quux = 26
3 %defstr baz xyzzy
3 ****************** expansion: baz = 'xyzzy'
4 __SECT__
5 %iassign boo -1
5 ****************** expansion: boo (case-insensitive) = -1
6 %define foobar(a,b) (a + b)
6 ****************** expansion: foobar = (a + b)
$ git diff asm/preproc.c
diff --git a/asm/preproc.c b/asm/preproc.c
index 6fc9f1ff..f18e7e53 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2052,6 +2052,7 @@ static SMacro *define_smacro(Context *ctx, const char
*mname,
{
SMacro *smac, **smhead;
struct hash_table *smtbl;
+ char *line;
if (smacro_defined(ctx, mname, nparam, &smac, casesense)) {
if (!smac) {
@@ -2082,6 +2083,14 @@ static SMacro *define_smacro(Context *ctx, const char
*mname,
smac->casesense = casesense;
smac->nparam = nparam;
smac->expansion = expansion;
+
+ expansion = reverse_tokens(expansion);
+ line = detoken(expansion, false);
+ lfmt->error(ERR_DEBUG, "expansion: %s%s = %s",
+ mname, casesense ? "" : " (case-insensitive)", line);
+ nasm_free(line);
+ expansion = reverse_tokens(expansion);
+
return smac;
}
$
--
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.
More information about the Nasm-bugs
mailing list