History

Revert "implement #pragma comment(lib,...)"

This reverts commit 8615bb40fb39bf7435462ca54cbbc24aaecae502. Reverting as it breaks on MinGW targets

Steven G. Messervey committed 11 years ago

Commit e50d68e1 parent 8615bb44 files · +15 −74Browse files

Unified · Split

4 files
  1. libtcc.c +13 −31
  2. tcc.c +2 −2
  3. tccpp.c +0 −38
  4. tcctok.h +0 −3
libtcc.c+13−31
@@ -515,7 +515,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, · 514 unmodified lines
515515 }
516516 #else
517517 if (! (sym->type.t & VT_STATIC))
518− other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT;
518+ other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT;
519519 #endif
520520 if (tcc_state->leading_underscore && can_add_underscore) {
521521 buf1[0] = '_';
@@ -829,31 +829,13 @@ static int tcc_compile(TCCState *s1) · 307 unmodified lines
829829
830830 LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str)
831831 {
832− int i;
833832 int len, ret;
834833 len = strlen(str);
835834
836835 tcc_open_bf(s, "<string>", len);
837836 memcpy(file->buffer, str, len);
838−
839− len = s->nb_files;
840837 ret = tcc_compile(s);
841838 tcc_close();
842−
843− /* habdle #pragma comment(lib,) */
844− for(i = len; i < s->nb_files; i++) {
845− /* int filetype = *(unsigned char *)s->files[i]; */
846− const char *filename = s->files[i] + 1;
847− if (filename[0] == '-' && filename[1] == 'l') {
848− if (tcc_add_library(s, filename + 2) < 0) {
849− tcc_warning("cannot find '%s'", filename+2);
850− ret++;
851− }
852− }
853− tcc_free(s->files[i]);
854− }
855− s->nb_files = len;
856−
857839 return ret;
858840 }
859841
@@ -1357,7 +1339,7 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 497 unmodified lines
13571339 {
13581340 s->output_type = output_type;
13591341 if (output_type == TCC_OUTPUT_PREPROCESS)
1360− print_defines();
1342+ print_defines();
13611343
13621344 if (!s->nostdinc) {
13631345 /* default include paths */
@@ -1917,16 +1899,16 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 553 unmodified lines
19171899 s->do_debug = 1;
19181900 break;
19191901 case TCC_OPTION_c:
1920− if (s->output_type)
1902+ if (s->output_type)
19211903 tcc_warning("-c: some compiler action already specified (%d)", s->output_type);
19221904 s->output_type = TCC_OUTPUT_OBJ;
19231905 break;
19241906 case TCC_OPTION_d:
1925− if (*optarg != 'D') {
1926− if (s->warn_unsupported)
1927− goto unsupported_option;
1907+ if (*optarg != 'D') {
1908+ if (s->warn_unsupported)
1909+ goto unsupported_option;
19281910 tcc_error("invalid option -- '%s'", r);
1929− }
1911+ }
19301912 s->dflag = 1;
19311913 break;
19321914 #ifdef TCC_TARGET_ARM
@@ -1945,11 +1927,11 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 12 unmodified lines
19451927 s->static_link = 1;
19461928 break;
19471929 case TCC_OPTION_std:
1948− /* silently ignore, a current purpose:
1949− allow to use a tcc as a reference compiler for "make test" */
1930+ /* silently ignore, a current purpose:
1931+ allow to use a tcc as a reference compiler for "make test" */
19501932 break;
19511933 case TCC_OPTION_shared:
1952− if (s->output_type)
1934+ if (s->output_type)
19531935 tcc_warning("-shared: some compiler action already specified (%d)", s->output_type);
19541936 s->output_type = TCC_OUTPUT_DLL;
19551937 break;
@@ -1964,7 +1946,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 8 unmodified lines
19641946 break;
19651947 case TCC_OPTION_r:
19661948 /* generate a .o merging several output files */
1967− if (s->output_type)
1949+ if (s->output_type)
19681950 tcc_warning("-r: some compiler action already specified (%d)", s->output_type);
19691951 s->option_r = 1;
19701952 s->output_type = TCC_OUTPUT_OBJ;
@@ -1982,7 +1964,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 11 unmodified lines
19821964 s->print_search_dirs = 1;
19831965 break;
19841966 case TCC_OPTION_run:
1985− if (s->output_type)
1967+ if (s->output_type)
19861968 tcc_warning("-run: some compiler action already specified (%d)", s->output_type);
19871969 s->output_type = TCC_OUTPUT_MEMORY;
19881970 tcc_set_options(s, optarg);
@@ -2013,7 +1995,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 24 unmodified lines
20131995 cstr_ccat(&linker_arg, '\0');
20141996 break;
20151997 case TCC_OPTION_E:
2016− if (s->output_type)
1998+ if (s->output_type)
20171999 tcc_warning("-E: some compiler action already specified (%d)", s->output_type);
20182000 s->output_type = TCC_OUTPUT_PREPROCESS;
20192001 break;
tcc.c+2−2
@@ -265,7 +265,7 @@ int main(int argc, char **argv) · 264 unmodified lines
265265 }
266266
267267 if (s->output_type == 0)
268− s->output_type = TCC_OUTPUT_EXE;
268+ s->output_type = TCC_OUTPUT_EXE;
269269
270270 if (s->option_m)
271271 exec_other_tcc(s, argv, s->option_m);
@@ -317,7 +317,7 @@ int main(int argc, char **argv) · 45 unmodified lines
317317 const char *filename = s->files[i] + 1;
318318 if (filename[0] == '-' && filename[1] == 'l') {
319319 if (tcc_add_library(s, filename + 2) < 0) {
320− tcc_error_noabort("cannot find '%s'", filename+2);
320+ tcc_error_noabort("cannot find '%s'", filename);
321321 ret = 1;
322322 }
323323 } else {
tccpp.c+0−38
@@ -1420,45 +1420,7 @@ static void pragma_parse(TCCState *s1) · 1419 unmodified lines
14201420 *s1->pack_stack_ptr = val;
14211421 skip(')');
14221422 }
1423− } else if (tok == TOK_comment) {
1424− if (s1->ms_extensions) {
1425− next();
1426− skip('(');
1427− if (tok == TOK_lib) {
1428− next();
1429− skip(',');
1430− if (tok != TOK_STR)
1431− tcc_error("invalid library specification");
1432− else {
1433− /**/
1434− int len = strlen((char *)tokc.cstr->data);
1435− char *file = tcc_malloc(len+4); /* filetype, "-l" and 0 at the end */
1436− file[0] = TCC_FILETYPE_BINARY;
1437− file[1] = '-';
1438− file[2] = 'l';
1439− strcpy(&file[3], (char *)tokc.cstr->data);
1440− dynarray_add((void ***)&s1->files, &s1->nb_files, file);
1441− /**/
1442− /* we can't use
1443− tcc_add_library(s1,(char *)tokc.cstr->data);
1444− while compiling some file
1445− */
1446− /*
1447− if (strrchr((char *)tokc.cstr->data,'.') == NULL)
1448− tcc_add_library(s1,(char *)tokc.cstr->data);
1449− else
1450− tcc_add_file(s1,(char *)tokc.cstr->data,TCC_FILETYPE_BINARY);
1451− */
1452− }
1453− next();
1454− tok = TOK_LINEFEED;
1455− }
1456− }
1457− else
1458− tcc_warning("#pragma comment(lib) is ignored");
14591423 }
1460− else
1461− tcc_warning("unknown #pragma %s", get_tok_str(tok, &tokc));
14621424 }
14631425
14641426 /* is_bof is true if first non space token at beginning of file */
tcctok.h+0−3
@@ -153,9 +153,6 @@ · 152 unmodified lines
153153 DEF(TOK_ASM_push, "push")
154154 DEF(TOK_ASM_pop, "pop")
155155 #endif
156− /* pragma comment & comment(lib,...) */
157− DEF(TOK_comment, "comment")
158− DEF(TOK_lib, "lib")
159156
160157 /* builtin functions or variables */
161158 #ifndef TCC_ARM_EABI

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t