mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
Fix -pthread option handling
adding -pthread confused option parsing as the number of file counting came out wrong. Simplify and fit it, can be handled purely within option parsing, no need for a state flag.
This commit is contained in:
parent
d348a9a51d
commit
3f8225509b
5
libtcc.c
5
libtcc.c
@ -1742,13 +1742,14 @@ reparse:
|
|||||||
tcc_set_lib_path(s, optarg);
|
tcc_set_lib_path(s, optarg);
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_l:
|
case TCC_OPTION_l:
|
||||||
|
add_lib:
|
||||||
args_parser_add_file(s, optarg, AFF_TYPE_LIB);
|
args_parser_add_file(s, optarg, AFF_TYPE_LIB);
|
||||||
s->nb_libraries++;
|
s->nb_libraries++;
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_pthread:
|
case TCC_OPTION_pthread:
|
||||||
parse_option_D(s, "_REENTRANT");
|
parse_option_D(s, "_REENTRANT");
|
||||||
s->option_pthread = 1;
|
optarg = "pthread";
|
||||||
break;
|
goto add_lib;
|
||||||
case TCC_OPTION_bench:
|
case TCC_OPTION_bench:
|
||||||
s->do_bench = 1;
|
s->do_bench = 1;
|
||||||
break;
|
break;
|
||||||
|
3
tcc.c
3
tcc.c
@ -297,9 +297,6 @@ redo:
|
|||||||
tcc_error("cannot specify libraries with -c");
|
tcc_error("cannot specify libraries with -c");
|
||||||
if (n > 1 && s->outfile)
|
if (n > 1 && s->outfile)
|
||||||
tcc_error("cannot specify output file with -c many files");
|
tcc_error("cannot specify output file with -c many files");
|
||||||
} else {
|
|
||||||
if (s->option_pthread)
|
|
||||||
tcc_set_options(s, "-lpthread");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->do_bench)
|
if (s->do_bench)
|
||||||
|
1
tcc.h
1
tcc.h
@ -817,7 +817,6 @@ struct TCCState {
|
|||||||
int do_bench; /* option -bench */
|
int do_bench; /* option -bench */
|
||||||
int gen_deps; /* option -MD */
|
int gen_deps; /* option -MD */
|
||||||
char *deps_outfile; /* option -MF */
|
char *deps_outfile; /* option -MF */
|
||||||
int option_pthread; /* -pthread option */
|
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user