| @@ -515,7 +515,7 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, · 514 unmodified lines |
| 515 | 515 | } |
| 516 | 516 | #else |
| 517 | 517 | 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; |
| 519 | 519 | #endif |
| 520 | 520 | if (tcc_state->leading_underscore && can_add_underscore) { |
| 521 | 521 | buf1[0] = '_'; |
| @@ -829,13 +829,31 @@ static int tcc_compile(TCCState *s1) · 307 unmodified lines |
| 829 | 829 | |
| 830 | 830 | LIBTCCAPI int tcc_compile_string(TCCState *s, const char *str) |
| 831 | 831 | { |
| 832 | + int i; |
| 832 | 833 | int len, ret; |
| 833 | 834 | len = strlen(str); |
| 834 | 835 | |
| 835 | 836 | tcc_open_bf(s, "<string>", len); |
| 836 | 837 | memcpy(file->buffer, str, len); |
| 838 | + |
| 839 | + len = s->nb_files; |
| 837 | 840 | ret = tcc_compile(s); |
| 838 | 841 | 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 | + |
| 839 | 857 | return ret; |
| 840 | 858 | } |
| 841 | 859 | |
| @@ -1339,7 +1357,7 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type) · 497 unmodified lines |
| 1339 | 1357 | { |
| 1340 | 1358 | s->output_type = output_type; |
| 1341 | 1359 | if (output_type == TCC_OUTPUT_PREPROCESS) |
| 1342 | | − print_defines(); |
| 1360 | + print_defines(); |
| 1343 | 1361 | |
| 1344 | 1362 | if (!s->nostdinc) { |
| 1345 | 1363 | /* default include paths */ |
| @@ -1899,16 +1917,16 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 553 unmodified lines |
| 1899 | 1917 | s->do_debug = 1; |
| 1900 | 1918 | break; |
| 1901 | 1919 | case TCC_OPTION_c: |
| 1902 | | − if (s->output_type) |
| 1920 | + if (s->output_type) |
| 1903 | 1921 | tcc_warning("-c: some compiler action already specified (%d)", s->output_type); |
| 1904 | 1922 | s->output_type = TCC_OUTPUT_OBJ; |
| 1905 | 1923 | break; |
| 1906 | 1924 | case TCC_OPTION_d: |
| 1907 | | − if (*optarg != 'D') { |
| 1908 | | − if (s->warn_unsupported) |
| 1909 | | − goto unsupported_option; |
| 1925 | + if (*optarg != 'D') { |
| 1926 | + if (s->warn_unsupported) |
| 1927 | + goto unsupported_option; |
| 1910 | 1928 | tcc_error("invalid option -- '%s'", r); |
| 1911 | | − } |
| 1929 | + } |
| 1912 | 1930 | s->dflag = 1; |
| 1913 | 1931 | break; |
| 1914 | 1932 | #ifdef TCC_TARGET_ARM |
| @@ -1927,11 +1945,11 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 12 unmodified lines |
| 1927 | 1945 | s->static_link = 1; |
| 1928 | 1946 | break; |
| 1929 | 1947 | case TCC_OPTION_std: |
| 1930 | | − /* silently ignore, a current purpose: |
| 1931 | | − allow to use a tcc as a reference compiler for "make test" */ |
| 1948 | + /* silently ignore, a current purpose: |
| 1949 | + allow to use a tcc as a reference compiler for "make test" */ |
| 1932 | 1950 | break; |
| 1933 | 1951 | case TCC_OPTION_shared: |
| 1934 | | − if (s->output_type) |
| 1952 | + if (s->output_type) |
| 1935 | 1953 | tcc_warning("-shared: some compiler action already specified (%d)", s->output_type); |
| 1936 | 1954 | s->output_type = TCC_OUTPUT_DLL; |
| 1937 | 1955 | break; |
| @@ -1946,7 +1964,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 8 unmodified lines |
| 1946 | 1964 | break; |
| 1947 | 1965 | case TCC_OPTION_r: |
| 1948 | 1966 | /* generate a .o merging several output files */ |
| 1949 | | − if (s->output_type) |
| 1967 | + if (s->output_type) |
| 1950 | 1968 | tcc_warning("-r: some compiler action already specified (%d)", s->output_type); |
| 1951 | 1969 | s->option_r = 1; |
| 1952 | 1970 | s->output_type = TCC_OUTPUT_OBJ; |
| @@ -1964,7 +1982,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 11 unmodified lines |
| 1964 | 1982 | s->print_search_dirs = 1; |
| 1965 | 1983 | break; |
| 1966 | 1984 | case TCC_OPTION_run: |
| 1967 | | − if (s->output_type) |
| 1985 | + if (s->output_type) |
| 1968 | 1986 | tcc_warning("-run: some compiler action already specified (%d)", s->output_type); |
| 1969 | 1987 | s->output_type = TCC_OUTPUT_MEMORY; |
| 1970 | 1988 | tcc_set_options(s, optarg); |
| @@ -1995,7 +2013,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 24 unmodified lines |
| 1995 | 2013 | cstr_ccat(&linker_arg, '\0'); |
| 1996 | 2014 | break; |
| 1997 | 2015 | case TCC_OPTION_E: |
| 1998 | | − if (s->output_type) |
| 2016 | + if (s->output_type) |
| 1999 | 2017 | tcc_warning("-E: some compiler action already specified (%d)", s->output_type); |
| 2000 | 2018 | s->output_type = TCC_OUTPUT_PREPROCESS; |
| 2001 | 2019 | break; |