| @@ -247,7 +247,6 @@ int main(int argc, char **argv) · 246 unmodified lines |
| 247 | TCCState *s; | 247 | TCCState *s; |
| 248 | int ret, optind, i, bench; | 248 | int ret, optind, i, bench; |
| 249 | int64_t start_time = 0; | 249 | int64_t start_time = 0; |
| 250 | const char *first_file = NULL; | | |
| 251 | | 250 | |
| 252 | s = tcc_new(); | 251 | s = tcc_new(); |
| 253 | | 252 | |
| @@ -286,7 +285,7 @@ int main(int argc, char **argv) · 32 unmodified lines |
| 286 | tcc_error("cannot specify multiple files with -c and -o"); | 285 | tcc_error("cannot specify multiple files with -c and -o"); |
| 287 | } | 286 | } |
| 288 | } | 287 | } |
| 289 | | 288 | |
| 290 | if (s->output_type == TCC_OUTPUT_PREPROCESS) { | 289 | if (s->output_type == TCC_OUTPUT_PREPROCESS) { |
| 291 | if (!s->outfile) { | 290 | if (!s->outfile) { |
| 292 | s->ppfp = stdout; | 291 | s->ppfp = stdout; |
| @@ -315,17 +314,16 @@ int main(int argc, char **argv) · 22 unmodified lines |
| 315 | } else { | 314 | } else { |
| 316 | if (1 == s->verbose) | 315 | if (1 == s->verbose) |
| 317 | printf("-> %s\n", filename); | 316 | printf("-> %s\n", filename); |
| | 317 | if (!s->outfile) |
| | 318 | s->outfile = default_outputfile(s, filename); |
| 318 | if (tcc_add_file(s, filename, filetype) < 0) | 319 | if (tcc_add_file(s, filename, filetype) < 0) |
| 319 | ret = 1; | 320 | ret = 1; |
| 320 | else | 321 | else |
| 321 | if (s->output_type == TCC_OUTPUT_OBJ) { | 322 | if (s->output_type == TCC_OUTPUT_OBJ) { |
| 322 | if (!s->outfile) | | |
| 323 | s->outfile = default_outputfile(s, filename); | | |
| 324 | ret = !!tcc_output_file(s, s->outfile); | 323 | ret = !!tcc_output_file(s, s->outfile); |
| | 324 | if (s->gen_deps && !ret) |
| | 325 | gen_makedeps(s, s->outfile, s->deps_outfile); |
| 325 | if (!ret) { | 326 | if (!ret) { |
| 326 | /* dump collected dependencies */ | | |
| 327 | if (s->gen_deps) | | |
| 328 | gen_makedeps(s, s->outfile, s->deps_outfile); | | |
| 329 | if ((i+1) < s->nb_files) { | 327 | if ((i+1) < s->nb_files) { |
| 330 | tcc_delete(s); | 328 | tcc_delete(s); |
| 331 | s = tcc_new(); | 329 | s = tcc_new(); |
| @@ -337,9 +335,6 @@ int main(int argc, char **argv) · 5 unmodified lines |
| 337 | } | 335 | } |
| 338 | } | 336 | } |
| 339 | } | 337 | } |
| 340 | else | | |
| 341 | if (!first_file) | | |
| 342 | first_file = filename; | | |
| 343 | } | 338 | } |
| 344 | } | 339 | } |
| 345 | | 340 | |
| @@ -354,14 +349,11 @@ int main(int argc, char **argv) · 8 unmodified lines |
| 354 | tcc_error_noabort("-run is not available in a cross compiler"); | 349 | tcc_error_noabort("-run is not available in a cross compiler"); |
| 355 | ret = 1; | 350 | ret = 1; |
| 356 | #endif | 351 | #endif |
| 357 | } else if (s->output_type == TCC_OUTPUT_PREPROCESS) { | 352 | } else |
| 358 | if (s->outfile) | 353 | if (s->output_type == TCC_OUTPUT_EXE || |
| 359 | fclose(s->ppfp); | 354 | s->output_type == TCC_OUTPUT_DLL) |
| 360 | } else if (s->output_type != TCC_OUTPUT_OBJ) { | 355 | { |
| 361 | if (!s->outfile) | | |
| 362 | s->outfile = default_outputfile(s, first_file); | | |
| 363 | ret = !!tcc_output_file(s, s->outfile); | 356 | ret = !!tcc_output_file(s, s->outfile); |
| 364 | /* dump collected dependencies */ | | |
| 365 | if (s->gen_deps && !ret) | 357 | if (s->gen_deps && !ret) |
| 366 | gen_makedeps(s, s->outfile, s->deps_outfile); | 358 | gen_makedeps(s, s->outfile, s->deps_outfile); |
| 367 | } | 359 | } |