[PATCH] [WineGCC]: correctly manage the -V option (gcc expects to be among the first ones, with -b)
Eric Pouech
eric.pouech at orange.fr
Tue Jan 18 14:50:37 CST 2011
A+
---
tools/winegcc/winegcc.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index dcfe778..837f38b 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -185,6 +185,7 @@ struct options
enum target_cpu target_cpu;
enum target_platform target_platform;
const char *target;
+ const char *version;
int shared;
int use_msvcrt;
int nostdinc;
@@ -283,7 +284,7 @@ static char* get_temp_file(const char* prefix, const char* suffix)
return tmp;
}
-static const strarray* get_translator(struct options *opts)
+static const strarray* get_translator(struct options *opts, const char* ver)
{
const char *str = NULL;
strarray *ret;
@@ -307,6 +308,8 @@ static const strarray* get_translator(struct options *opts)
assert(0);
}
ret = strarray_fromstring( str, " " );
+ if (ver)
+ strarray_add( ret, strmake("-V%s", opts->version));
if (opts->force_pointer_size)
strarray_add( ret, strmake("-m%u", 8 * opts->force_pointer_size ));
return ret;
@@ -380,7 +383,7 @@ static void compile(struct options* opts, const char* lang)
unsigned int j;
int gcc_defs = 0;
- strarray_addall(comp_args, get_translator(opts));
+ strarray_addall(comp_args, get_translator(opts, opts->version));
switch(opts->processor)
{
case proc_cpp: gcc_defs = 1; break;
@@ -785,7 +788,7 @@ static void build(struct options* opts)
}
else
{
- strarray_addall(link_args, get_translator(opts));
+ strarray_addall(link_args, get_translator(opts, NULL));
strarray_add(link_args, opts->gui_app ? "-mwindows" : "-mconsole");
if (opts->nodefaultlibs) strarray_add(link_args, "-nodefaultlibs");
}
@@ -969,7 +972,7 @@ static void build(struct options* opts)
if (fake_module) return; /* nothing else to do */
/* link everything together now */
- strarray_addall(link_args, get_translator(opts));
+ strarray_addall(link_args, get_translator(opts, NULL));
strarray_addall(link_args, strarray_fromstring(LDDLLFLAGS, " "));
strarray_add(link_args, "-o");
@@ -1058,7 +1061,7 @@ static void forward(int argc, char **argv, struct options* opts)
strarray* args = strarray_alloc();
int j;
- strarray_addall(args, get_translator(opts));
+ strarray_addall(args, get_translator(opts, NULL));
for( j = 1; j < argc; j++ )
strarray_add(args, argv[j]);
@@ -1114,7 +1117,7 @@ static int is_linker_arg(const char* arg)
*/
static int is_target_arg(const char* arg)
{
- return arg[1] == 'b' || arg[2] == 'V';
+ return arg[1] == 'b' || arg[1] == 'V';
}
@@ -1291,7 +1294,7 @@ int main(int argc, char **argv)
raw_linker_arg = 0;
if (argv[i][1] == 'c' || argv[i][1] == 'L')
raw_compiler_arg = 0;
- if (argv[i][1] == 'o' || argv[i][1] == 'b')
+ if (argv[i][1] == 'o' || argv[i][1] == 'b' || argv[i][1] == 'V')
raw_compiler_arg = raw_linker_arg = 0;
/* do a bit of semantic analysis */
@@ -1314,6 +1317,9 @@ int main(int argc, char **argv)
case 'b':
parse_target_option( &opts, option_arg );
break;
+ case 'V':
+ opts.version = xstrdup( option_arg );
+ break;
case 'c': /* compile or assemble */
if (argv[i][2] == 0) opts.compile_only = 1;
/* fall through */
More information about the wine-patches
mailing list