Mercurial > hg > index.cgi
comparison lwasm/pragma.c @ 562:6237505ee1dc
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.
author | William Astle <lost@l-w.ca> |
---|---|
date | Fri, 01 Dec 2023 21:11:56 -0700 |
parents | 1260b4eec5a5 |
children |
comparison
equal
deleted
inserted
replaced
561:a6a9d46f071f | 562:6237505ee1dc |
---|---|
53 { "cescapes", "nocescapes", PRAGMA_CESCAPES }, | 53 { "cescapes", "nocescapes", PRAGMA_CESCAPES }, |
54 { "importundefexport", "noimportundefexport", PRAGMA_IMPORTUNDEFEXPORT }, | 54 { "importundefexport", "noimportundefexport", PRAGMA_IMPORTUNDEFEXPORT }, |
55 { "pcaspcr", "nopcaspcr", PRAGMA_PCASPCR }, | 55 { "pcaspcr", "nopcaspcr", PRAGMA_PCASPCR }, |
56 { "shadow", "noshadow", PRAGMA_SHADOW }, | 56 { "shadow", "noshadow", PRAGMA_SHADOW }, |
57 { "nolist", "list", PRAGMA_NOLIST }, | 57 { "nolist", "list", PRAGMA_NOLIST }, |
58 { "nolistcode", "listcode", PRAGMA_NOLISTCODE }, | |
58 { "autobranchlength", "noautobranchlength", PRAGMA_AUTOBRANCHLENGTH }, | 59 { "autobranchlength", "noautobranchlength", PRAGMA_AUTOBRANCHLENGTH }, |
59 { "export", "noexport", PRAGMA_EXPORT }, | 60 { "export", "noexport", PRAGMA_EXPORT }, |
60 { "symbolnocase", "nosymbolnocase", PRAGMA_SYMBOLNOCASE }, | 61 { "symbolnocase", "nosymbolnocase", PRAGMA_SYMBOLNOCASE }, |
61 { "nosymbolcase", "symbolcase", PRAGMA_SYMBOLNOCASE }, | 62 { "nosymbolcase", "symbolcase", PRAGMA_SYMBOLNOCASE }, |
62 { "condundefzero", "nocondundefzero", PRAGMA_CONDUNDEFZERO }, | 63 { "condundefzero", "nocondundefzero", PRAGMA_CONDUNDEFZERO }, |
145 { | 146 { |
146 lwasm_register_error(as, l, E_PRAGMA_UNRECOGNIZED); | 147 lwasm_register_error(as, l, E_PRAGMA_UNRECOGNIZED); |
147 } | 148 } |
148 if (as -> pragmas & PRAGMA_NOLIST) | 149 if (as -> pragmas & PRAGMA_NOLIST) |
149 l -> pragmas |= PRAGMA_NOLIST; | 150 l -> pragmas |= PRAGMA_NOLIST; |
151 if (as -> pragmas & PRAGMA_NOLISTCODE) | |
152 l -> pragmas |= PRAGMA_NOLISTCODE; | |
150 if (as->pragmas & PRAGMA_CC) | 153 if (as->pragmas & PRAGMA_CC) |
151 { | 154 { |
152 l->pragmas |= PRAGMA_CC; | 155 l->pragmas |= PRAGMA_CC; |
153 as->pragmas &= ~PRAGMA_CC; | 156 as->pragmas &= ~PRAGMA_CC; |
154 } | 157 } |
169 | 172 |
170 // *pragma must NEVER throw an error | 173 // *pragma must NEVER throw an error |
171 parse_pragma_string(as, ps, 1); | 174 parse_pragma_string(as, ps, 1); |
172 if (as -> pragmas & PRAGMA_NOLIST) | 175 if (as -> pragmas & PRAGMA_NOLIST) |
173 l -> pragmas |= PRAGMA_NOLIST; | 176 l -> pragmas |= PRAGMA_NOLIST; |
177 if (as -> pragmas & PRAGMA_NOLISTCODE) | |
178 l -> pragmas |= PRAGMA_NOLISTCODE; | |
174 if (as->pragmas & PRAGMA_CC) | 179 if (as->pragmas & PRAGMA_CC) |
175 { | 180 { |
176 l->pragmas |= PRAGMA_CC; | 181 l->pragmas |= PRAGMA_CC; |
177 as->pragmas &= ~PRAGMA_CC; | 182 as->pragmas &= ~PRAGMA_CC; |
178 } | 183 } |
224 parse_pragma_string(as, (char *)&(pse->str), 1); | 229 parse_pragma_string(as, (char *)&(pse->str), 1); |
225 lw_free(pse); | 230 lw_free(pse); |
226 } | 231 } |
227 if (set_pragmas[i].flag == PRAGMA_NOLIST) | 232 if (set_pragmas[i].flag == PRAGMA_NOLIST) |
228 l -> pragmas |= PRAGMA_NOLIST; | 233 l -> pragmas |= PRAGMA_NOLIST; |
234 if (set_pragmas[i].flag == PRAGMA_NOLISTCODE) | |
235 l -> pragmas |= PRAGMA_NOLISTCODE; | |
229 } | 236 } |
230 } | 237 } |
231 lw_free(pp); | 238 lw_free(pp); |
232 } | 239 } |
233 | 240 |
280 | 287 |
281 input_stack_push(as, (input_stack_entry *)pse); | 288 input_stack_push(as, (input_stack_entry *)pse); |
282 | 289 |
283 if (set_pragmas[i].flag == PRAGMA_NOLIST) | 290 if (set_pragmas[i].flag == PRAGMA_NOLIST) |
284 l -> pragmas |= PRAGMA_NOLIST; | 291 l -> pragmas |= PRAGMA_NOLIST; |
292 if (set_pragmas[i].flag == PRAGMA_NOLISTCODE) | |
293 l -> pragmas |= PRAGMA_NOLISTCODE; | |
285 } | 294 } |
286 } | 295 } |
287 lw_free(pp); | 296 lw_free(pp); |
288 } | 297 } |
289 | 298 |