comparison lwasm/pragma.c @ 81:428068681cbf

Added nolist pragma to suppress listing output of non-code generating lines
author Lost Wizard (lost@starbug3)
date Wed, 25 May 2011 19:13:33 -0600
parents 337301ddf74a
children 8fa52c3f2970
comparison
equal deleted inserted replaced
80:585cd68253f0 81:428068681cbf
41 { "undefextern", PRAGMA_UNDEFEXTERN }, 41 { "undefextern", PRAGMA_UNDEFEXTERN },
42 { "cescapes", PRAGMA_CESCAPES }, 42 { "cescapes", PRAGMA_CESCAPES },
43 { "importundefexport", PRAGMA_IMPORTUNDEFEXPORT }, 43 { "importundefexport", PRAGMA_IMPORTUNDEFEXPORT },
44 { "pcaspcr", PRAGMA_PCASPCR }, 44 { "pcaspcr", PRAGMA_PCASPCR },
45 { "shadow", PRAGMA_SHADOW }, 45 { "shadow", PRAGMA_SHADOW },
46 { "nolist", PRAGMA_NOLIST },
46 { 0, 0 } 47 { 0, 0 }
47 }; 48 };
48 49
49 static const struct pragma_list reset_pragmas[] = 50 static const struct pragma_list reset_pragmas[] =
50 { 51 {
53 { "noundefextern", PRAGMA_UNDEFEXTERN }, 54 { "noundefextern", PRAGMA_UNDEFEXTERN },
54 { "nocescapes", PRAGMA_CESCAPES }, 55 { "nocescapes", PRAGMA_CESCAPES },
55 { "noimportundefexport", PRAGMA_IMPORTUNDEFEXPORT }, 56 { "noimportundefexport", PRAGMA_IMPORTUNDEFEXPORT },
56 { "nopcaspcr", PRAGMA_PCASPCR }, 57 { "nopcaspcr", PRAGMA_PCASPCR },
57 { "noshadow", PRAGMA_SHADOW }, 58 { "noshadow", PRAGMA_SHADOW },
59 { "list", PRAGMA_NOLIST },
58 { 0, 0 } 60 { 0, 0 }
59 }; 61 };
60 62
61 int parse_pragma_string(asmstate_t *as, char *str, int ignoreerr) 63 int parse_pragma_string(asmstate_t *as, char *str, int ignoreerr)
62 { 64 {
111 113
112 if (parse_pragma_string(as, ps, 0) == 0) 114 if (parse_pragma_string(as, ps, 0) == 0)
113 { 115 {
114 lwasm_register_error(as, l, "Unrecognized pragma string"); 116 lwasm_register_error(as, l, "Unrecognized pragma string");
115 } 117 }
118 if (as -> pragmas & PRAGMA_NOLIST)
119 l -> pragmas |= PRAGMA_NOLIST;
116 lw_free(ps); 120 lw_free(ps);
117 } 121 }
118 122
119 PARSEFUNC(pseudo_parse_starpragma) 123 PARSEFUNC(pseudo_parse_starpragma)
120 { 124 {
128 132
129 l -> len = 0; 133 l -> len = 0;
130 134
131 // *pragma must NEVER throw an error 135 // *pragma must NEVER throw an error
132 parse_pragma_string(as, ps, 1); 136 parse_pragma_string(as, ps, 1);
137 if (as -> pragmas & PRAGMA_NOLIST)
138 l -> pragmas |= PRAGMA_NOLIST;
133 lw_free(ps); 139 lw_free(ps);
134 } 140 }