Mercurial > hg > index.cgi
changeset 474:74d0c394666e
Add "noexpandcond" pragma (cleans up listings)
This pragma will suppress listing of conditionals and any statements that
appear within a false conditional block.
author | William Astle <lost@l-w.ca> |
---|---|
date | Fri, 02 Nov 2018 21:07:50 -0600 |
parents | 8181ddd707f1 |
children | b9917c4dc6cf |
files | lwasm/list.c lwasm/lwasm.h lwasm/pass1.c lwasm/pragma.c lwasm/pseudo.c |
diffstat | 5 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/list.c Thu Nov 01 23:07:03 2018 -0600 +++ b/lwasm/list.c Fri Nov 02 21:07:50 2018 -0600 @@ -136,6 +136,8 @@ memmove(obytes, cl -> output, cl -> outputl); } } + if (cl -> hidecond && CURPRAGMA(cl, PRAGMA_NOEXPANDCOND)) + continue; if ((cl -> len < 1 && cl -> dlen < 1) && obytelen < 1 && (cl -> symset == 1 || cl -> sym == NULL) ) { if (cl -> soff >= 0)
--- a/lwasm/lwasm.h Thu Nov 01 23:07:03 2018 -0600 +++ b/lwasm/lwasm.h Fri Nov 02 21:07:50 2018 -0600 @@ -109,6 +109,7 @@ PRAGMA_OPERANDSIZE = 1 << 25, // warn if operand size is bigger than required 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_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status }; @@ -307,6 +308,7 @@ int noexpand_start; // start of a no-expand block int noexpand_end; // end of a no-expand block int hideline; // set if we're going to hide this line on output + int hidecond; // set if we're going to hide this line due to condition hiding }; enum
--- a/lwasm/pass1.c Thu Nov 01 23:07:03 2018 -0600 +++ b/lwasm/pass1.c Fri Nov 02 21:07:50 2018 -0600 @@ -448,7 +448,9 @@ } if (as -> skipcond || as -> inmacro || cl -> ltext[0] == 1) cl -> hideline = 1; - + if (as -> skipcond) + cl -> hidecond = 1; + nextline: if (sym) lw_free(sym);
--- a/lwasm/pragma.c Thu Nov 01 23:07:03 2018 -0600 +++ b/lwasm/pragma.c Fri Nov 02 21:07:50 2018 -0600 @@ -77,6 +77,7 @@ { "operandsizewarning", "nooperandsizewarning", PRAGMA_OPERANDSIZE }, { "emuext", "noemuext", PRAGMA_EMUEXT }, { "nooutput", "output", PRAGMA_NOOUTPUT }, + { "noexpandcond", "expandcond", PRAGMA_NOEXPANDCOND }, { 0, 0, 0 } };
--- a/lwasm/pseudo.c Thu Nov 01 23:07:03 2018 -0600 +++ b/lwasm/pseudo.c Fri Nov 02 21:07:50 2018 -0600 @@ -1102,7 +1102,8 @@ { l -> len = 0; l -> hideline = 1; - + l -> hidecond = 1; + if (as -> skipcond && !(as -> skipmacro)) { as -> skipcount++; @@ -1117,6 +1118,7 @@ { l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1134,6 +1136,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1158,6 +1161,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1183,6 +1187,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1207,6 +1212,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1231,6 +1237,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1254,6 +1261,8 @@ lw_expr_t e; l -> hideline = 1; + l -> hidecond = 1; + l -> len = 0; if (as -> skipcond && !(as -> skipmacro)) @@ -1276,6 +1285,8 @@ PARSEFUNC(pseudo_parse_endc) { l -> hideline = 1; + l -> hidecond = 1; + l -> len = 0; skip_operand(p); if (as -> skipcond && !(as -> skipmacro)) @@ -1289,6 +1300,7 @@ PARSEFUNC(pseudo_parse_else) { l -> len = 0; + l -> hidecond = 1; l -> hideline = 1; skip_operand(p); @@ -1316,6 +1328,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1356,6 +1369,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) { @@ -1390,6 +1404,7 @@ l -> len = 0; l -> hideline = 1; + l -> hidecond = 1; if (as -> skipcond && !(as -> skipmacro)) {