mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-03 04:30:08 +08:00
Revert "implement #pragma comment(lib,...)"
This reverts commit 8615bb40fb
.
Reverting as it breaks on MinGW targets
This commit is contained in:
parent
8615bb40fb
commit
e50d68e417
18
libtcc.c
18
libtcc.c
@ -829,31 +829,13 @@ static int tcc_compile(TCCState *s1)
|
|||||||
|
|
||||||
LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str)
|
LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int len, ret;
|
int len, ret;
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
|
|
||||||
tcc_open_bf(s, "<string>", len);
|
tcc_open_bf(s, "<string>", len);
|
||||||
memcpy(file->buffer, str, len);
|
memcpy(file->buffer, str, len);
|
||||||
|
|
||||||
len = s->nb_files;
|
|
||||||
ret = tcc_compile(s);
|
ret = tcc_compile(s);
|
||||||
tcc_close();
|
tcc_close();
|
||||||
|
|
||||||
/* habdle #pragma comment(lib,) */
|
|
||||||
for(i = len; i < s->nb_files; i++) {
|
|
||||||
/* int filetype = *(unsigned char *)s->files[i]; */
|
|
||||||
const char *filename = s->files[i] + 1;
|
|
||||||
if (filename[0] == '-' && filename[1] == 'l') {
|
|
||||||
if (tcc_add_library(s, filename + 2) < 0) {
|
|
||||||
tcc_warning("cannot find '%s'", filename+2);
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tcc_free(s->files[i]);
|
|
||||||
}
|
|
||||||
s->nb_files = len;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
tcc.c
2
tcc.c
@ -317,7 +317,7 @@ int main(int argc, char **argv)
|
|||||||
const char *filename = s->files[i] + 1;
|
const char *filename = s->files[i] + 1;
|
||||||
if (filename[0] == '-' && filename[1] == 'l') {
|
if (filename[0] == '-' && filename[1] == 'l') {
|
||||||
if (tcc_add_library(s, filename + 2) < 0) {
|
if (tcc_add_library(s, filename + 2) < 0) {
|
||||||
tcc_error_noabort("cannot find '%s'", filename+2);
|
tcc_error_noabort("cannot find '%s'", filename);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
38
tccpp.c
38
tccpp.c
@ -1420,45 +1420,7 @@ static void pragma_parse(TCCState *s1)
|
|||||||
*s1->pack_stack_ptr = val;
|
*s1->pack_stack_ptr = val;
|
||||||
skip(')');
|
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);
|
|
||||||
/**/
|
|
||||||
/* we can't use
|
|
||||||
tcc_add_library(s1,(char *)tokc.cstr->data);
|
|
||||||
while compiling some file
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
if (strrchr((char *)tokc.cstr->data,'.') == NULL)
|
|
||||||
tcc_add_library(s1,(char *)tokc.cstr->data);
|
|
||||||
else
|
|
||||||
tcc_add_file(s1,(char *)tokc.cstr->data,TCC_FILETYPE_BINARY);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
next();
|
|
||||||
tok = TOK_LINEFEED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tcc_warning("#pragma comment(lib) is ignored");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
tcc_warning("unknown #pragma %s", get_tok_str(tok, &tokc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is_bof is true if first non space token at beginning of file */
|
/* is_bof is true if first non space token at beginning of file */
|
||||||
|
3
tcctok.h
3
tcctok.h
@ -153,9 +153,6 @@
|
|||||||
DEF(TOK_ASM_push, "push")
|
DEF(TOK_ASM_push, "push")
|
||||||
DEF(TOK_ASM_pop, "pop")
|
DEF(TOK_ASM_pop, "pop")
|
||||||
#endif
|
#endif
|
||||||
/* pragma comment & comment(lib,...) */
|
|
||||||
DEF(TOK_comment, "comment")
|
|
||||||
DEF(TOK_lib, "lib")
|
|
||||||
|
|
||||||
/* builtin functions or variables */
|
/* builtin functions or variables */
|
||||||
#ifndef TCC_ARM_EABI
|
#ifndef TCC_ARM_EABI
|
||||||
|
Loading…
Reference in New Issue
Block a user