From: Rémi Bernon rbernon@codeweavers.com
--- tools/winegcc/winegcc.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index d98c0e18ce3..8f5b7df71a1 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -543,7 +543,7 @@ static struct strarray get_link_args( const char *output_name ) }
if (is_unicode_app) strarray_add( &flags, "-municode" ); - if (subsystem) strarray_add( &flags, strmake("-Wl,--subsystem,%s", subsystem )); + strarray_add( &flags, strmake( "-Wl,--subsystem,%s", subsystem ) );
strarray_add( &flags, "-Wl,--exclude-all-symbols" ); strarray_add( &flags, "-Wl,--nxcompat" ); @@ -599,12 +599,9 @@ static struct strarray get_link_args( const char *output_name )
if (entry_point) strarray_add( &flags, strmake( "-Wl,-entry:%s", entry_point ));
- if (subsystem) - { - if ((version = strchr( subsystem, ':' ))) subsystem = strmake( "%.*s,%s", (int)(version - subsystem), subsystem, version + 1 ); - strarray_add( &flags, "-Xlinker" ); - strarray_add( &flags, strmake( "-subsystem:%s", subsystem ) ); - } + if ((version = strchr( subsystem, ':' ))) subsystem = strmake( "%.*s,%s", (int)(version - subsystem), subsystem, version + 1 ); + strarray_add( &flags, "-Xlinker" ); + strarray_add( &flags, strmake( "-subsystem:%s", subsystem ) );
STRARRAY_FOR_EACH( file, &output_debug_files ) { @@ -1138,11 +1135,8 @@ static void build_spec_obj( const char *spec_file, const char *output_file, strarray_add(&spec_args, output_name); }
- if (subsystem) - { - strarray_add( &spec_args, "--subsystem" ); - strarray_add( &spec_args, subsystem ); - } + strarray_add( &spec_args, "--subsystem" ); + strarray_add( &spec_args, subsystem );
if (!is_shared && large_address_aware) strarray_add( &spec_args, "--large-address-aware" );
@@ -1314,7 +1308,7 @@ static void build(struct strarray input_files, const char *output)
if (!wine_objdir && !nodefaultlibs) { - if (subsystem && !strncmp( subsystem, "windows", 7 )) + if (!strncmp( subsystem, "windows", 7 )) { add_library(lib_dirs, &files, "shell32"); add_library(lib_dirs, &files, "comdlg32"); @@ -1344,7 +1338,7 @@ static void build(struct strarray input_files, const char *output) /* set default entry point, if needed */ if (!entry_point) { - if (subsystem && !strcmp( subsystem, "native" )) + if (!strcmp( subsystem, "native" )) entry_point = (is_pe && target.cpu == CPU_i386) ? "DriverEntry@8" : "DriverEntry"; else if (use_msvcrt && !is_shared && !is_win16_app) entry_point = is_unicode_app ? "wmainCRTStartup" : "mainCRTStartup"; @@ -1627,6 +1621,7 @@ int main(int argc, char **argv) includedir = get_includedir( bindir ); target = init_argv0_target( argv[0] ); path_dirs = strarray_frompath( getenv( "PATH" )); + subsystem = "console";
/* setup tmp file removal at exit */ atexit(clean_temp_files); @@ -1772,12 +1767,12 @@ int main(int argc, char **argv) } else if (strcmp("-mwindows", args.str[i]) == 0) { - if (!subsystem || strncmp( subsystem, "windows", 7 )) subsystem = "windows"; + if (strncmp( subsystem, "windows", 7 )) subsystem = "windows"; raw_compiler_arg = 0; } else if (strcmp("-mconsole", args.str[i]) == 0) { - if (!subsystem || strncmp( subsystem, "console", 7 )) subsystem = "console"; + if (strncmp( subsystem, "console", 7 )) subsystem = "console"; raw_compiler_arg = 0; } else if (strcmp("-municode", args.str[i]) == 0) @@ -1852,7 +1847,6 @@ int main(int argc, char **argv) { is_shared = true; raw_compiler_arg = raw_linker_arg = 0; - if (!subsystem) subsystem = "console"; } else if (strcmp("-s", args.str[i]) == 0) {