aboutsummaryrefslogtreecommitdiff
path: root/tccpp.c
diff options
context:
space:
mode:
authorSteven G. Messervey <nuke48386@yahoo.com>2015-04-15 22:56:21 -0400
committerSteven G. Messervey <nuke48386@yahoo.com>2015-04-15 22:56:21 -0400
commitaeaff94ec1dba0096d7b943ad7c963d9d574d922 (patch)
tree590287410450e9dba0aab731b3db7792934abd8a /tccpp.c
parente50d68e4175d9ffa2915d67100ee8f9c5faf8cf1 (diff)
downloadtinycc-aeaff94ec1dba0096d7b943ad7c963d9d574d922.tar.gz
tinycc-aeaff94ec1dba0096d7b943ad7c963d9d574d922.tar.bz2
implement #pragma comment(lib,...)
Diffstat (limited to 'tccpp.c')
-rw-r--r--tccpp.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tccpp.c b/tccpp.c
index 111ea2b..e3c9910 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1420,7 +1420,34 @@ static void pragma_parse(TCCState *s1)
*s1->pack_stack_ptr = val;
skip(')');
}
+ } else if (tok == TOK_comment) {
+ if (s1->ms_extensions) {
+ next();
+ skip('(');
+ if (tok == TOK_lib) {
+ next();
+ skip(',');
+ if (tok != TOK_STR) {
+ tcc_error("invalid library specification");
+ } else {
+ int len = strlen((char *)tokc.cstr->data);
+ char *file = tcc_malloc(len + 4); /* filetype, "-l", and \0 at the end */
+ file[0] = TCC_FILETYPE_BINARY;
+ file[1] = '-';
+ file[2] = 'l';
+ strcpy(&file[3],(char *)tokc.cstr->data);
+ dynarray_add((void ***)&s1->files, &s1->nb_files, file);
+ }
+ next();
+ tok = TOK_LINEFEED;
+ } else {
+ tcc_warning("unknown #pragma %s", get_tok_str(tok, &tokc));
+ }
+ } else {
+ tcc_warning("#pragma comment(lib) is ignored");
+ }
}
+
}
/* is_bof is true if first non space token at beginning of file */