Lines 160-169
AttribDeclaration::toObjFile (int)
Link Here
|
160 |
void |
160 |
void |
161 |
PragmaDeclaration::toObjFile (int) |
161 |
PragmaDeclaration::toObjFile (int) |
162 |
{ |
162 |
{ |
|
|
163 |
if (ident == Id::lib && flag_pragma_lib_filename) { |
164 |
Expression *e = (*args)[0]; |
165 |
StringExp *se = e->toString(); |
166 |
if (se->len > 0) { |
167 |
char *name = new char[se->len + 1]; |
168 |
memcpy(name, se->string, se->len); |
169 |
name[se->len] = 0; |
170 |
if (flag_pragma_lib_filename && flag_pragma_lib_file_created >= 0) { |
171 |
FILE *fo = fopen(flag_pragma_lib_filename, (flag_pragma_lib_file_created ? "a" : "w")); |
172 |
if (fo) { |
173 |
flag_pragma_lib_file_created = 1; // file successfully created |
174 |
fprintf(fo, "-l\"%s\"\n", name); |
175 |
fclose(fo); |
176 |
} else { |
177 |
flag_pragma_lib_file_created = -1; // error occured, don't try to do this anymore |
178 |
warning (loc, "can't write pragma(lib) file '%s'", flag_pragma_lib_filename); |
179 |
} |
180 |
} |
181 |
delete [] name; |
182 |
} |
183 |
} |
184 |
|
163 |
if (!global.params.ignoreUnsupportedPragmas) |
185 |
if (!global.params.ignoreUnsupportedPragmas) |
164 |
{ |
186 |
{ |
165 |
if (ident == Id::lib) |
187 |
if (ident == Id::lib && !flag_pragma_lib_filename) |
166 |
warning (loc, "pragma(lib) not implemented"); |
188 |
warning (loc, "pragma(lib) not implemented (you can use -fwrite-pragma-libs=<filename> to write it to <filename>)"); |
167 |
else if (ident == Id::startaddress) |
189 |
else if (ident == Id::startaddress) |
168 |
warning (loc, "pragma(startaddress) not implemented"); |
190 |
warning (loc, "pragma(startaddress) not implemented"); |
169 |
} |
191 |
} |