gcc.c (SWITCH_CURTAILS_COMPILATION): Definition.
authorNick Clifton <nickc@cygnus.com>
Sun, 17 May 1998 23:08:40 +0000 (23:08 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 17 May 1998 23:08:40 +0000 (17:08 -0600)
        * 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

gcc/ChangeLog
gcc/gcc.c
gcc/tm.texi

index e2cbd10b62881f9ec15b7df2cf8d973c456281fb..831cd540031a8f1e073f320a65f98d1eb6067740 100644 (file)
@@ -1,3 +1,14 @@
+Mon May 18 00:08:19 1998  Nick Clifton  <nickc@cygnus.com>
+
+       * 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.
+
 Sun May 17 23:59:45 1998  John Wehle  (john@feith.com)
 
        * i386.h (ALIGN_DFmode): Delete.
index f2efe5694345c7dc682d0da50be37d324a640d37..c2c1af628094838ea33a845d419c5654b71307e6 100644 (file)
--- 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
 \f
+
+#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;
 
index b95514e538bbbebe912462767cfa01d32d963937..9ae707403b53b8a7991a1934674dc2f902ae9600 100644 (file)
@@ -76,6 +76,21 @@ wish to add additional options which take arguments.  Any redefinition
 should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
 additional options.
 
+@findex SWITCH_CURTAILS_COMPILATION
+@item SWITCH_CURTAILS_COMPILATION (@var{char})
+A C expression which determines whether the option @samp{-@var{char}}
+stops compilation before the generation of an executable.  The value is
+boolean, non-zero if the option does stop an executable from being
+generated, zero otherwise.
+
+By default, this macro is defined as
+@code{DEFAULT_SWITCH_CURTAILS_COMPILATION}, which handles the standard
+options properly.  You need not define
+@code{SWITCH_CURTAILS_COMPILATION} unless you wish to add additional
+options which affect the generation of an executable.  Any redefinition
+should call @code{DEFAULT_SWITCH_CURTAILS_COMPILATION} and then check
+for additional options.
+
 @findex SWITCHES_NEED_SPACES
 @item SWITCHES_NEED_SPACES
 A string-valued C expression which enumerates the options for which