aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@cygnus.com>1998-05-17 23:08:40 +0000
committerJeff Law <law@gcc.gnu.org>1998-05-17 17:08:40 -0600
commit88117d44fdf73af5014673a4c6ef028e5e7486af (patch)
tree2f16e1bc3300b7a15436e611d2cf3152a373c390 /gcc/gcc.c
parente5e8a8bf3921f126e8ce4e14b02d99ceaa6805c7 (diff)
downloadgcc-88117d44fdf73af5014673a4c6ef028e5e7486af.zip
gcc-88117d44fdf73af5014673a4c6ef028e5e7486af.tar.gz
gcc-88117d44fdf73af5014673a4c6ef028e5e7486af.tar.bz2
gcc.c (SWITCH_CURTAILS_COMPILATION): Definition.
* gcc.c (SWITCH_CURTAILS_COMPILATION): Definition. (DEFAULT_SWITCH_CURTAILS_COMPILATION): True for options -S and -c. (process_command): If HAVE_EXECUTABLE_SUFFIX is defined then scan command line arguments to see if an executable is not being created, and if so - do not append the suffix. * tm.texi (SWITCH_CURTAILS_COMPILATION): Add description of new driver macro. From-SVN: r19824
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index f2efe56..c2c1af6 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -536,6 +536,18 @@ static struct user_specs *user_specs_head, *user_specs_tail;
#define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR)
#endif
+
+#ifdef HAVE_EXECUTABLE_SUFFIX
+/* This defines which switches stop a full compilation. */
+#define DEFAULT_SWITCH_CURTAILS_COMPILATION(CHAR) \
+ ((CHAR) == 'c' || (CHAR) == 'S')
+
+#ifndef SWITCH_CURTAILS_COMPILATION
+#define SWITCH_CURTAILS_COMPILATION(CHAR) \
+ DEFAULT_SWITCH_CURTAILS_COMPILATION(CHAR)
+#endif
+#endif
+
/* Record the mapping from file suffixes for compilation specs. */
struct compiler
@@ -2780,6 +2792,7 @@ process_command (argc, argv)
}
break;
+ case 'S':
case 'c':
if (p[1] == 0)
{
@@ -2791,10 +2804,40 @@ process_command (argc, argv)
case 'o':
have_o = 1;
+#if defined(HAVE_EXECUTABLE_SUFFIX)
+ if (! have_c)
+ {
+ int skip;
+
+ /* Forward scan, just in case -S or -c is specified
+ after -o. */
+ int j = i + 1;
+ if (p[1] == 0)
+ ++j;
+ while (j < argc)
+ {
+ if (argv[j][0] == '-')
+ {
+ if (SWITCH_CURTAILS_COMPILATION (argv[j][1])
+ && argv[j][2] == 0)
+ {
+ have_c = 1;
+ break;
+ }
+ else if (skip = SWITCH_TAKES_ARG (argv[j][1]))
+ j += skip - (argv[j][2] != 0);
+ else if (skip = WORD_SWITCH_TAKES_ARG (argv[j] + 1))
+ j += skip;
+ }
+ j++;
+ }
+ }
+#endif
#if defined(HAVE_EXECUTABLE_SUFFIX) || defined(HAVE_OBJECT_SUFFIX)
- argv[i] = convert_filename (argv[i], 1);
if (p[1] == 0)
- argv[i+1] = convert_filename (argv[i+1], 1);
+ argv[i+1] = convert_filename (argv[i+1], ! have_c);
+ else
+ argv[i] = convert_filename (argv[i], ! have_c);
#endif
goto normal_switch;