Jacek Caban : winegcc: Check more target components for platform string.
Alexandre Julliard
julliard at winehq.org
Thu Feb 27 17:15:10 CST 2020
Module: wine
Branch: master
Commit: cf20f54dd9399b2860366140b4bb561839362504
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cf20f54dd9399b2860366140b4bb561839362504
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Feb 27 13:38:12 2020 +0100
winegcc: Check more target components for platform string.
Fixes parsing llvm style mingw target *-pc-windows-gnu.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winegcc/winegcc.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index c3eafdfc21..e53e32e22d 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1395,7 +1395,7 @@ static int is_linker_arg(const char* arg)
static void parse_target_option( struct options *opts, const char *target )
{
- char *p, *platform, *spec = xstrdup( target );
+ char *p, *spec = xstrdup( target );
unsigned int i;
/* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */
@@ -1415,13 +1415,11 @@ static void parse_target_option( struct options *opts, const char *target )
}
if (i == ARRAY_SIZE(cpu_names))
error( "Unrecognized CPU '%s'\n", spec );
- platform = p;
- if ((p = strrchr( p, '-' ))) platform = p + 1;
}
else if (!strcmp( spec, "mingw32" ))
{
opts->target_cpu = CPU_x86;
- platform = spec;
+ p = spec;
}
else
error( "Invalid target specification '%s'\n", target );
@@ -1429,13 +1427,18 @@ static void parse_target_option( struct options *opts, const char *target )
/* get the OS part */
opts->target_platform = PLATFORM_UNSPECIFIED; /* default value */
- for (i = 0; i < ARRAY_SIZE(platform_names); i++)
+ for (;;)
{
- if (!strncmp( platform_names[i].name, platform, strlen(platform_names[i].name) ))
+ for (i = 0; i < ARRAY_SIZE(platform_names); i++)
{
- opts->target_platform = platform_names[i].platform;
- break;
+ if (!strncmp( platform_names[i].name, p, strlen(platform_names[i].name) ))
+ {
+ opts->target_platform = platform_names[i].platform;
+ break;
+ }
}
+ if (opts->target_platform != PLATFORM_UNSPECIFIED || !(p = strchr( p, '-' ))) break;
+ p++;
}
free( spec );
More information about the wine-cvs
mailing list