# HG changeset patch # User William Astle # Date 1701490316 25200 # Node ID 6237505ee1dc09fab6300cad89818c14a001d2c4 # Parent a6a9d46f071f010f3338980a0517660466aa3c37 Add pragma nolistcode which works like nolist but also suppresses code lines It is occasionally useful to suppress parts of a listing that generate code. This nolistcode pragma works exactly like nolist but also suppresses code for just that reason. diff -r a6a9d46f071f -r 6237505ee1dc lwasm/list.c --- a/lwasm/list.c Thu Nov 30 16:54:12 2023 -0700 +++ b/lwasm/list.c Fri Dec 01 21:11:56 2023 -0700 @@ -73,6 +73,10 @@ char *linespec; nl = cl -> next; + if (CURPRAGMA(cl, PRAGMA_NOLISTCODE)) + { + continue; + } if (CURPRAGMA(cl, PRAGMA_NOLIST)) { if (cl -> outputl <= 0) diff -r a6a9d46f071f -r 6237505ee1dc lwasm/lwasm.h --- a/lwasm/lwasm.h Thu Nov 30 16:54:12 2023 -0700 +++ b/lwasm/lwasm.h Fri Dec 01 21:11:56 2023 -0700 @@ -115,6 +115,7 @@ PRAGMA_EMUEXT = 1 << 26, // enable emulator extensions PRAGMA_NOOUTPUT = 1 << 27, // disable object code output PRAGMA_NOEXPANDCOND = 1 << 28, // hide conditionals and skipped output in listings + PRAGMA_NOLISTCODE = 1 << 29, // hide line in listing even if it generates code PRAGMA_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status }; diff -r a6a9d46f071f -r 6237505ee1dc lwasm/pragma.c --- a/lwasm/pragma.c Thu Nov 30 16:54:12 2023 -0700 +++ b/lwasm/pragma.c Fri Dec 01 21:11:56 2023 -0700 @@ -55,6 +55,7 @@ { "pcaspcr", "nopcaspcr", PRAGMA_PCASPCR }, { "shadow", "noshadow", PRAGMA_SHADOW }, { "nolist", "list", PRAGMA_NOLIST }, + { "nolistcode", "listcode", PRAGMA_NOLISTCODE }, { "autobranchlength", "noautobranchlength", PRAGMA_AUTOBRANCHLENGTH }, { "export", "noexport", PRAGMA_EXPORT }, { "symbolnocase", "nosymbolnocase", PRAGMA_SYMBOLNOCASE }, @@ -147,6 +148,8 @@ } if (as -> pragmas & PRAGMA_NOLIST) l -> pragmas |= PRAGMA_NOLIST; + if (as -> pragmas & PRAGMA_NOLISTCODE) + l -> pragmas |= PRAGMA_NOLISTCODE; if (as->pragmas & PRAGMA_CC) { l->pragmas |= PRAGMA_CC; @@ -171,6 +174,8 @@ parse_pragma_string(as, ps, 1); if (as -> pragmas & PRAGMA_NOLIST) l -> pragmas |= PRAGMA_NOLIST; + if (as -> pragmas & PRAGMA_NOLISTCODE) + l -> pragmas |= PRAGMA_NOLISTCODE; if (as->pragmas & PRAGMA_CC) { l->pragmas |= PRAGMA_CC; @@ -226,6 +231,8 @@ } if (set_pragmas[i].flag == PRAGMA_NOLIST) l -> pragmas |= PRAGMA_NOLIST; + if (set_pragmas[i].flag == PRAGMA_NOLISTCODE) + l -> pragmas |= PRAGMA_NOLISTCODE; } } lw_free(pp); @@ -282,6 +289,8 @@ if (set_pragmas[i].flag == PRAGMA_NOLIST) l -> pragmas |= PRAGMA_NOLIST; + if (set_pragmas[i].flag == PRAGMA_NOLISTCODE) + l -> pragmas |= PRAGMA_NOLISTCODE; } } lw_free(pp);