[Nasm-bugs] [Bug 3392567] [Feature request] Listing preprocessor define results in list file
noreply-nasm at gorcunov.org
noreply-nasm at gorcunov.org
Fri Aug 9 03:31:52 PDT 2019
https://bugzilla.nasm.us/show_bug.cgi?id=3392567
--- Comment #3 from C. Masloch <pushbx at 38.de> ---
Same patch applied to
https://repo.or.cz/nasm.git/commitdiff/1c21a53e4ed03371df5d9f16359545862bb4820e
still seems to work.
$ git diff asm
diff --git a/asm/preproc.c b/asm/preproc.c
index 7a5d11fe..d30f9d87 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2113,6 +2113,53 @@ static SMacro *define_smacro(Context *ctx, const char
*mname,
smac->nparam = nparam;
smac->expansion = expansion;
smac->expand = smacro_expand_default;
+
+ {
+#define DEFINE_SMACRO_BUFFERSIZE (32 + 2)
+ int ii;
+ Context *cc;
+ char *line, buffer[DEFINE_SMACRO_BUFFERSIZE];
+ expansion = reverse_tokens(expansion);
+ line = detoken(expansion, false);
+ buffer[0] = 0;
+ ii = 0;
+ if (ctx) {
+ ii = 1;
+ cc = cstk;
+ while (cc != ctx && cc) {
+ ++ii;
+ cc = cc->next;
+ }
+ if (!cc) {
+ strcpy(buffer, "%(context not found)");
+ ii = 0;
+ }
+ }
+ if (ii == 0) {
+ ;
+ } else if (ii > (DEFINE_SMACRO_BUFFERSIZE - 2)) {
+ strcpy(buffer, "%(context too deep)");
+ } else {
+ buffer[ii + 1] = 0;
+ buffer[0] = '%';
+ while (ii) {
+ buffer[ii] = '$';
+ --ii;
+ }
+ }
+ if (ctx && ctx->name) {
+ lfmt->error(ERR_DEBUG, "expansion: (context \"%s\") %s%s%s = %s",
+ ctx->name, buffer,
+ mname, casesense ? "" : " (case-insensitive)", line);
+ } else {
+ lfmt->error(ERR_DEBUG, "expansion: %s%s%s = %s",
+ buffer,
+ mname, casesense ? "" : " (case-insensitive)", line);
+ }
+ nasm_free(line);
+ expansion = reverse_tokens(expansion);
+ }
+
return smac;
}
$
--
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.
More information about the Nasm-bugs
mailing list