Commit 3a265431 by Doug Evans

gcc.c (process_command): New local lang_n_files, and use it in test of -c with -o.

	* gcc.c (process_command): New local lang_n_files, and use
	it in test of -c with -o.  Move test of -save-temps.
	Test for trailing NUL in -c.

From-SVN: r11038
parent 5b65a74f
...@@ -2361,6 +2361,7 @@ process_command (argc, argv) ...@@ -2361,6 +2361,7 @@ process_command (argc, argv)
int last_language_n_infiles; int last_language_n_infiles;
int have_c = 0; int have_c = 0;
int have_o = 0; int have_o = 0;
int lang_n_infiles = 0;
gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX"); gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX");
...@@ -2615,6 +2616,11 @@ process_command (argc, argv) ...@@ -2615,6 +2616,11 @@ process_command (argc, argv)
} }
else if (strncmp (argv[i], "-l", 2) == 0) else if (strncmp (argv[i], "-l", 2) == 0)
n_infiles++; n_infiles++;
else if (strcmp (argv[i], "-save-temps") == 0)
{
save_temps_flag = 1;
n_switches++;
}
else if (argv[i][0] == '-' && argv[i][1] != 0) else if (argv[i][0] == '-' && argv[i][1] != 0)
{ {
register char *p = &argv[i][1]; register char *p = &argv[i][1];
...@@ -2697,20 +2703,15 @@ process_command (argc, argv) ...@@ -2697,20 +2703,15 @@ process_command (argc, argv)
warn_std_ptr = &warn_std; warn_std_ptr = &warn_std;
break; break;
case 's': case 'c':
if (!strcmp (p, "save-temps")) if (p[1] == 0)
{ {
save_temps_flag = 1; have_c = 1;
n_switches++; n_switches++;
break; break;
} }
goto normal_switch; goto normal_switch;
case 'c':
have_c = 1;
n_switches++;
break;
case 'o': case 'o':
have_o = 1; have_o = 1;
goto normal_switch; goto normal_switch;
...@@ -2726,10 +2727,13 @@ process_command (argc, argv) ...@@ -2726,10 +2727,13 @@ process_command (argc, argv)
} }
} }
else else
n_infiles++; {
n_infiles++;
lang_n_infiles++;
}
} }
if (have_c && have_o && n_infiles != 1) if (have_c && have_o && lang_n_infiles > 1)
fatal ("cannot specify -o with -c and multiple compilations"); fatal ("cannot specify -o with -c and multiple compilations");
/* Set up the search paths before we go looking for config files. */ /* Set up the search paths before we go looking for config files. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment