History

Warn about a conflicting compile options spectified on the command line. Try "tcc -E -c tccasm.c -o tccasm.o"

seyko committed 11 years ago

Commit c334b591 parent b93179f3 files · +19 −7Browse files

Unified · Split

3 files
  1. libtcc.c +11 −1
  2. libtcc.h +5 −5
  3. tcc.c +3 −1
libtcc.c+11−1
@@ -906,7 +906,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 905 unmodified lines
906#else906#else
907 tcc_set_lib_path(s, CONFIG_TCCDIR);907 tcc_set_lib_path(s, CONFIG_TCCDIR);
908#endif908#endif
909 s->output_type = TCC_OUTPUT_MEMORY;909 s->output_type = 0;
910 preprocess_new();910 preprocess_new();
911 s->include_stack_ptr = s->include_stack;911 s->include_stack_ptr = s->include_stack;
912 912
@@ -1831,6 +1831,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 918 unmodified lines
1831 s->do_debug = 1;1831 s->do_debug = 1;
1832 break;1832 break;
1833 case TCC_OPTION_c:1833 case TCC_OPTION_c:
1834 if (s->output_type)
1835 tcc_warning("-c: some compiler action already specified (%d)", s->output_type);
1834 s->output_type = TCC_OUTPUT_OBJ;1836 s->output_type = TCC_OUTPUT_OBJ;
1835 break;1837 break;
1836#ifdef TCC_TARGET_ARM1838#ifdef TCC_TARGET_ARM
@@ -1849,6 +1851,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 12 unmodified lines
1849 s->static_link = 1;1851 s->static_link = 1;
1850 break;1852 break;
1851 case TCC_OPTION_shared:1853 case TCC_OPTION_shared:
1854 if (s->output_type)
1855 tcc_warning("-shared: some compiler action already specified (%d)", s->output_type);
1852 s->output_type = TCC_OUTPUT_DLL;1856 s->output_type = TCC_OUTPUT_DLL;
1853 break;1857 break;
1854 case TCC_OPTION_soname:1858 case TCC_OPTION_soname:
@@ -1862,6 +1866,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 7 unmodified lines
1862 break;1866 break;
1863 case TCC_OPTION_r:1867 case TCC_OPTION_r:
1864 /* generate a .o merging several output files */1868 /* generate a .o merging several output files */
1869 if (s->output_type)
1870 tcc_warning("-r: some compiler action already specified (%d)", s->output_type);
1865 s->option_r = 1;1871 s->option_r = 1;
1866 s->output_type = TCC_OUTPUT_OBJ;1872 s->output_type = TCC_OUTPUT_OBJ;
1867 break;1873 break;
@@ -1878,6 +1884,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 10 unmodified lines
1878 s->print_search_dirs = 1;1884 s->print_search_dirs = 1;
1879 break;1885 break;
1880 case TCC_OPTION_run:1886 case TCC_OPTION_run:
1887 if (s->output_type)
1888 tcc_warning("-run: some compiler action already specified (%d)", s->output_type);
1881 s->output_type = TCC_OUTPUT_MEMORY;1889 s->output_type = TCC_OUTPUT_MEMORY;
1882 tcc_set_options(s, optarg);1890 tcc_set_options(s, optarg);
1883 run = 1;1891 run = 1;
@@ -1907,6 +1915,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv) · 23 unmodified lines
1907 cstr_ccat(&linker_arg, '\0');1915 cstr_ccat(&linker_arg, '\0');
1908 break;1916 break;
1909 case TCC_OPTION_E:1917 case TCC_OPTION_E:
1918 if (s->output_type)
1919 tcc_warning("-E: some compiler action already specified (%d)", s->output_type);
1910 s->output_type = TCC_OUTPUT_PREPROCESS;1920 s->output_type = TCC_OUTPUT_PREPROCESS;
1911 break;1921 break;
1912 case TCC_OPTION_MD:1922 case TCC_OPTION_MD:
libtcc.h+5−5
@@ -58,11 +58,11 @@ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf); · 57 unmodified lines
58 58
59/* set output type. MUST BE CALLED before any compilation */59/* set output type. MUST BE CALLED before any compilation */
60LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);60LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type);
61#define TCC_OUTPUT_MEMORY 0 /* output will be run in memory (default) */61#define TCC_OUTPUT_MEMORY 1 /* output will be run in memory (default) */
62#define TCC_OUTPUT_EXE 1 /* executable file */62#define TCC_OUTPUT_EXE 2 /* executable file */
63#define TCC_OUTPUT_DLL 2 /* dynamic library */63#define TCC_OUTPUT_DLL 3 /* dynamic library */
64#define TCC_OUTPUT_OBJ 3 /* object file */64#define TCC_OUTPUT_OBJ 4 /* object file */
65#define TCC_OUTPUT_PREPROCESS 4 /* only preprocess (used internally) */65#define TCC_OUTPUT_PREPROCESS 5 /* only preprocess (used internally) */
66 66
67/* equivalent to -Lpath option */67/* equivalent to -Lpath option */
68LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);68LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname);
tcc.c+3−1
@@ -249,7 +249,6 @@ int main(int argc, char **argv) · 248 unmodified lines
249 const char *first_file = NULL;249 const char *first_file = NULL;
250 250
251 s = tcc_new();251 s = tcc_new();
252 s->output_type = TCC_OUTPUT_EXE;
253 252
254 optind = tcc_parse_args(s, argc - 1, argv + 1);253 optind = tcc_parse_args(s, argc - 1, argv + 1);
255 tcc_set_environment(s);254 tcc_set_environment(s);
@@ -259,6 +258,9 @@ int main(int argc, char **argv) · 3 unmodified lines
259 return 1;258 return 1;
260 }259 }
261 260
261 if (s->output_type == 0)
262 s->output_type = TCC_OUTPUT_EXE;
263
262 if (s->option_m)264 if (s->option_m)
263 exec_other_tcc(s, argv, s->option_m);265 exec_other_tcc(s, argv, s->option_m);
264 266

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