[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 13:15:45 PDT 2019
https://bugzilla.nasm.us/show_bug.cgi?id=3392567
--- Comment #2 from C. Masloch <pushbx at 38.de> ---
I noticed that context-local labels were displayed without the %$ prefix with
my previous patch. Here's a replacement that fixes this, and also displays a
context's name if one is set.
Of course, the handling still should be put into a conditional enabled per
pragma.
This patch is as applied to
https://repo.or.cz/nasm.git/commitdiff/437e0ffa01505d173a8b9cfe2decf74f2e9795a5
because of the failure with the latest master head, described in
https://bugzilla.nasm.us/show_bug.cgi?id=3392572
diff --git a/asm/preproc.c b/asm/preproc.c
index 95ca56fc..2732f25d 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -2082,6 +2082,53 @@ static bool define_smacro(Context *ctx, const char
*mname, bool casesense,
smac->nparam = nparam;
smac->expansion = expansion;
smac->in_progress = false;
+
+ {
+#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 true; /* Success */
}
--
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