aboutsummaryrefslogtreecommitdiff
path: root/libtcc.c
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-17 20:32:07 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-17 20:32:07 +0100
commite31579b0769e1f9c0947d12e83316d1149307b1a (patch)
treee37403a22a234a5b760eb172fd1287eca3b193a6 /libtcc.c
parent1d673cbfd619995f2762d3e216f8f0f842effc8c (diff)
downloadtinycc-e31579b0769e1f9c0947d12e83316d1149307b1a.tar.gz
tinycc-e31579b0769e1f9c0947d12e83316d1149307b1a.tar.bz2
Fixed tests on Windows (including out-of-tree problems)
Modified tcctest.c so that it uses 'double' in place of 'long double' with MinGW since this is what TCC does, and what Visual C++ does. Added an option -norunsrc to tcc to allow argv[0] to be set independently of the compiled source when using tcc -run, which allows tests that rely on the value of argv[0] to work in out-of-tree builds. Also added Makefile rules to automatically update out-of-tree build Makefiles when in-tree Makefiles have changed.
Diffstat (limited to 'libtcc.c')
-rw-r--r--libtcc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libtcc.c b/libtcc.c
index 3ef1682..9ee4ea6 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1638,6 +1638,7 @@ enum {
TCC_OPTION_pedantic,
TCC_OPTION_pthread,
TCC_OPTION_run,
+ TCC_OPTION_norunsrc,
TCC_OPTION_v,
TCC_OPTION_w,
TCC_OPTION_pipe,
@@ -1677,6 +1678,7 @@ static const TCCOption tcc_options[] = {
{ "pedantic", TCC_OPTION_pedantic, 0},
{ "pthread", TCC_OPTION_pthread, 0},
{ "run", TCC_OPTION_run, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
+ { "norunsrc", TCC_OPTION_norunsrc, 0 },
{ "rdynamic", TCC_OPTION_rdynamic, 0 },
{ "r", TCC_OPTION_r, 0 },
{ "s", TCC_OPTION_s, 0 },
@@ -1715,6 +1717,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
const TCCOption *popt;
const char *optarg, *r;
int run = 0;
+ int norunsrc = 0;
int pthread = 0;
int optind = 0;
@@ -1727,7 +1730,8 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
r = argv[optind++];
if (r[0] != '-' || r[1] == '\0') {
/* add a new file */
- dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r));
+ if (!run || !norunsrc)
+ dynarray_add((void ***)&s->files, &s->nb_files, tcc_strdup(r));
if (run) {
optind--;
/* argv[0] will be this file */
@@ -1841,6 +1845,9 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int argc, char **argv)
tcc_set_options(s, optarg);
run = 1;
break;
+ case TCC_OPTION_norunsrc:
+ norunsrc = 1;
+ break;
case TCC_OPTION_v:
do ++s->verbose; while (*optarg++ == 'v');
break;