aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-01 20:04:33 +0200
committergrischka <grischka>2016-10-01 20:04:33 +0200
commite63011377173062d688a08e8a98abbdada453302 (patch)
tree5bdd5ab87de49ee86f33a3dd553e7b12a6fe16af /libtcc.c
parent3ddbfe1a82bb1a7c24d0c4ddd68d8cad1b2b2a20 (diff)
downloadtinycc-e63011377173062d688a08e8a98abbdada453302.tar.gz
tinycc-e63011377173062d688a08e8a98abbdada453302.tar.bz2
Revert "ability to compile multiple *.c files with -c switch"
copy & paste coding, twisted control flow This reverts commit a13f183e4c2c4b4d1d40e142b57a4298672dfd2c. Also, set linker args for DLLs also.
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/libtcc.c b/libtcc.c
index dbbc01f..5467298 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1061,7 +1061,7 @@ LIBTCCAPI TCCState *tcc_new(void)
#else
tcc_set_lib_path(s, CONFIG_TCCDIR);
#endif
- s->output_type = 0;
+
preprocess_new();
s->include_stack_ptr = s->include_stack;
@@ -1229,10 +1229,6 @@ LIBTCCAPI void tcc_delete(TCCState *s1)
tcc_cleanup();
- /* close a preprocessor output */
- if (s1->ppfp && s1->ppfp != stdout)
- fclose(s1->ppfp);
-
/* free all sections */
for(i = 1; i < s1->nb_sections; i++)
free_section(s1->sections[i]);
@@ -1609,16 +1605,6 @@ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type)
{
s->output_type = output_type;
- if (s->output_type == TCC_OUTPUT_PREPROCESS) {
- if (!s->outfile) {
- s->ppfp = stdout;
- } else {
- s->ppfp = fopen(s->outfile, "w");
- if (!s->ppfp)
- tcc_error("could not write '%s'", s->outfile);
- }
- }
-
if (!s->nostdinc) {
/* default include paths */
/* -isystem paths have already been handled */
@@ -2289,6 +2275,9 @@ ST_FUNC int tcc_parse_args1(TCCState *s, int argc, char **argv)
s->print_search_dirs = 1;
break;
case TCC_OPTION_run:
+#ifndef TCC_IS_NATIVE
+ tcc_error("-run is not available in a cross compiler");
+#endif
if (s->output_type)
tcc_warning("-run: some compiler action already specified (%d)", s->output_type);
s->output_type = TCC_OUTPUT_MEMORY;
@@ -2397,7 +2386,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
s->nb_libraries++;
}
- if (s->output_type == TCC_OUTPUT_EXE)
+ if (s->output_type == TCC_OUTPUT_EXE || s->output_type == TCC_OUTPUT_DLL)
tcc_set_linker(s, (const char *)pas->linker_arg.data);
if (is_allocated) {