Patchwork Remove SWITCHES_NEED_SPACES

login
register
mail settings
Submitter Joseph S. Myers
Date June 26, 2010, 4:02 p.m.
Message ID <Pine.LNX.4.64.1006261601130.30463@digraph.polyomino.org.uk>
Download mbox | patch
Permalink /patch/57058/
State New
Headers show

Comments

Joseph S. Myers - June 26, 2010, 4:02 p.m.
This patch removes the SWITCHES_NEED_SPACES target macro, making the
present behavior unconditional, as discussed in
<http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02633.html>.

Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
commit?

2010-06-26  Joseph Myers  <joseph@codesourcery.com>

	* collect2.c (main): Remove SWITCHES_NEED_SPACES conditional.
	* doc/tm.texi (SWITCHES_NEED_SPACES): Don't document.
	* gcc.c (SWITCHES_NEED_SPACES, switches_need_spaces): Remove.
	(static_specs): Remove switches_need_spaces.
	(process_command, do_self_spec): Hardcode handling "-o" instead of
	checking switches_need_spaces.
	* system.h (SWITCHES_NEED_SPACES): Poison.
Richard Guenther - June 26, 2010, 4:10 p.m.
On Sat, Jun 26, 2010 at 6:02 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> This patch removes the SWITCHES_NEED_SPACES target macro, making the
> present behavior unconditional, as discussed in
> <http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02633.html>.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit?

Ok.

Thanks,
Richard.

> 2010-06-26  Joseph Myers  <joseph@codesourcery.com>
>
>        * collect2.c (main): Remove SWITCHES_NEED_SPACES conditional.
>        * doc/tm.texi (SWITCHES_NEED_SPACES): Don't document.
>        * gcc.c (SWITCHES_NEED_SPACES, switches_need_spaces): Remove.
>        (static_specs): Remove switches_need_spaces.
>        (process_command, do_self_spec): Hardcode handling "-o" instead of
>        checking switches_need_spaces.
>        * system.h (SWITCHES_NEED_SPACES): Poison.
>
> diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/collect2.c gcc-mainline/gcc/collect2.c
> --- gcc-mainline-opt5-single-pass/gcc/collect2.c        2010-06-25 04:16:38.000000000 -0700
> +++ gcc-mainline/gcc/collect2.c 2010-06-26 06:20:33.000000000 -0700
> @@ -1535,12 +1535,7 @@ main (int argc, char **argv)
>            case 'o':
>              if (arg[2] == '\0')
>                output_file = *ld1++ = *ld2++ = *++argv;
> -             else if (1
> -#ifdef SWITCHES_NEED_SPACES
> -                      && ! strchr (SWITCHES_NEED_SPACES, arg[1])
> -#endif
> -                      )
> -
> +             else
>                output_file = &arg[2];
>              break;
>
> diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/doc/tm.texi gcc-mainline/gcc/doc/tm.texi
> --- gcc-mainline-opt5-single-pass/gcc/doc/tm.texi       2010-06-25 04:16:26.000000000 -0700
> +++ gcc-mainline/gcc/doc/tm.texi        2010-06-26 06:21:15.000000000 -0700
> @@ -141,13 +141,6 @@ should call @code{DEFAULT_SWITCH_CURTAIL
>  for additional options.
>  @end defmac
>
> -@defmac SWITCHES_NEED_SPACES
> -A string-valued C expression which enumerates the options for which
> -the linker needs a space between the option and its argument.
> -
> -If this macro is not defined, the default value is @code{""}.
> -@end defmac
> -
>  @defmac TARGET_OPTION_TRANSLATE_TABLE
>  If defined, a list of pairs of strings, the first of which is a
>  potential command line target to the @file{gcc} driver program, and the
> diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/gcc.c gcc-mainline/gcc/gcc.c
> --- gcc-mainline-opt5-single-pass/gcc/gcc.c     2010-06-26 03:36:56.000000000 -0700
> +++ gcc-mainline/gcc/gcc.c      2010-06-26 06:22:07.000000000 -0700
> @@ -664,18 +664,6 @@ proper position among the other output f
>   "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
>  #endif
>
> -/* config.h can define SWITCHES_NEED_SPACES to control which options
> -   require spaces between the option and the argument.
> -
> -   We define SWITCHES_NEED_SPACES to include "o" by default.  This
> -   causes "-ofoo.o" to be split into "-o foo.o" during the initial
> -   processing of the command-line, before being seen by the specs
> -   machinery.  This makes sure we record "foo.o" as the temporary file
> -   to be deleted in the case of error, rather than "-ofoo.o".  */
> -#ifndef SWITCHES_NEED_SPACES
> -#define SWITCHES_NEED_SPACES "o"
> -#endif
> -
>  /* config.h can define ENDFILE_SPEC to override the default crtn files.  */
>  #ifndef ENDFILE_SPEC
>  #define ENDFILE_SPEC ""
> @@ -811,7 +799,6 @@ static const char *link_gomp_spec = "";
>  static const char *libgcc_spec = LIBGCC_SPEC;
>  static const char *endfile_spec = ENDFILE_SPEC;
>  static const char *startfile_spec = STARTFILE_SPEC;
> -static const char *switches_need_spaces = SWITCHES_NEED_SPACES;
>  static const char *linker_name_spec = LINKER_NAME;
>  static const char *linker_plugin_file_spec = "";
>  static const char *lto_wrapper_spec = "";
> @@ -1644,7 +1631,6 @@ static struct spec_list static_specs[] =
>   INIT_STATIC_SPEC ("link_gomp",               &link_gomp_spec),
>   INIT_STATIC_SPEC ("libgcc",                  &libgcc_spec),
>   INIT_STATIC_SPEC ("startfile",               &startfile_spec),
> -  INIT_STATIC_SPEC ("switches_need_spaces",    &switches_need_spaces),
>   INIT_STATIC_SPEC ("cross_compile",           &cross_compile),
>   INIT_STATIC_SPEC ("version",                 &compiler_version),
>   INIT_STATIC_SPEC ("multilib",                        &multilib_select),
> @@ -4207,9 +4193,9 @@ process_command (int argc, const char **
>                  /* Null-terminate the vector.  */
>                  switches[n_switches].args[j] = 0;
>                }
> -             else if (strchr (switches_need_spaces, c))
> +             else if (c == 'o')
>                {
> -                 /* On some systems, ld cannot handle some options without
> +                 /* On some systems, ld cannot handle "-o" without
>                     a space.  So split the option from its argument.  */
>                  char *part1 = XNEWVEC (char, 2);
>                  part1[0] = c;
> @@ -4779,9 +4765,9 @@ do_self_spec (const char *spec)
>              /* Null-terminate the vector.  */
>              sw->args[j] = 0;
>            }
> -         else if (strchr (switches_need_spaces, c))
> +         else if (c == 'o')
>            {
> -             /* On some systems, ld cannot handle some options without
> +             /* On some systems, ld cannot handle "-o" without
>                 a space.  So split the option from its argument.  */
>              char *part1 = XNEWVEC (char, 2);
>              part1[0] = c;
> diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/system.h gcc-mainline/gcc/system.h
> --- gcc-mainline-opt5-single-pass/gcc/system.h  2010-06-25 06:15:53.000000000 -0700
> +++ gcc-mainline/gcc/system.h   2010-06-26 06:21:01.000000000 -0700
> @@ -769,7 +769,7 @@ extern void fancy_abort (const char *, i
>        ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE                    \
>        STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD                  \
>        ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE                 \
> -       ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME
> +       ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES
>
>  /* Hooks that are no longer used.  */
>  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>

Patch

diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/collect2.c gcc-mainline/gcc/collect2.c
--- gcc-mainline-opt5-single-pass/gcc/collect2.c	2010-06-25 04:16:38.000000000 -0700
+++ gcc-mainline/gcc/collect2.c	2010-06-26 06:20:33.000000000 -0700
@@ -1535,12 +1535,7 @@  main (int argc, char **argv)
 	    case 'o':
 	      if (arg[2] == '\0')
 		output_file = *ld1++ = *ld2++ = *++argv;
-	      else if (1
-#ifdef SWITCHES_NEED_SPACES
-		       && ! strchr (SWITCHES_NEED_SPACES, arg[1])
-#endif
-		       )
-
+	      else
 		output_file = &arg[2];
 	      break;
 
diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/doc/tm.texi gcc-mainline/gcc/doc/tm.texi
--- gcc-mainline-opt5-single-pass/gcc/doc/tm.texi	2010-06-25 04:16:26.000000000 -0700
+++ gcc-mainline/gcc/doc/tm.texi	2010-06-26 06:21:15.000000000 -0700
@@ -141,13 +141,6 @@  should call @code{DEFAULT_SWITCH_CURTAIL
 for additional options.
 @end defmac
 
-@defmac SWITCHES_NEED_SPACES
-A string-valued C expression which enumerates the options for which
-the linker needs a space between the option and its argument.
-
-If this macro is not defined, the default value is @code{""}.
-@end defmac
-
 @defmac TARGET_OPTION_TRANSLATE_TABLE
 If defined, a list of pairs of strings, the first of which is a
 potential command line target to the @file{gcc} driver program, and the
diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/gcc.c gcc-mainline/gcc/gcc.c
--- gcc-mainline-opt5-single-pass/gcc/gcc.c	2010-06-26 03:36:56.000000000 -0700
+++ gcc-mainline/gcc/gcc.c	2010-06-26 06:22:07.000000000 -0700
@@ -664,18 +664,6 @@  proper position among the other output f
   "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}"
 #endif
 
-/* config.h can define SWITCHES_NEED_SPACES to control which options
-   require spaces between the option and the argument.
-
-   We define SWITCHES_NEED_SPACES to include "o" by default.  This
-   causes "-ofoo.o" to be split into "-o foo.o" during the initial
-   processing of the command-line, before being seen by the specs
-   machinery.  This makes sure we record "foo.o" as the temporary file
-   to be deleted in the case of error, rather than "-ofoo.o".  */
-#ifndef SWITCHES_NEED_SPACES
-#define SWITCHES_NEED_SPACES "o"
-#endif
-
 /* config.h can define ENDFILE_SPEC to override the default crtn files.  */
 #ifndef ENDFILE_SPEC
 #define ENDFILE_SPEC ""
@@ -811,7 +799,6 @@  static const char *link_gomp_spec = "";
 static const char *libgcc_spec = LIBGCC_SPEC;
 static const char *endfile_spec = ENDFILE_SPEC;
 static const char *startfile_spec = STARTFILE_SPEC;
-static const char *switches_need_spaces = SWITCHES_NEED_SPACES;
 static const char *linker_name_spec = LINKER_NAME;
 static const char *linker_plugin_file_spec = "";
 static const char *lto_wrapper_spec = "";
@@ -1644,7 +1631,6 @@  static struct spec_list static_specs[] =
   INIT_STATIC_SPEC ("link_gomp",		&link_gomp_spec),
   INIT_STATIC_SPEC ("libgcc",			&libgcc_spec),
   INIT_STATIC_SPEC ("startfile",		&startfile_spec),
-  INIT_STATIC_SPEC ("switches_need_spaces",	&switches_need_spaces),
   INIT_STATIC_SPEC ("cross_compile",		&cross_compile),
   INIT_STATIC_SPEC ("version",			&compiler_version),
   INIT_STATIC_SPEC ("multilib",			&multilib_select),
@@ -4207,9 +4193,9 @@  process_command (int argc, const char **
 		  /* Null-terminate the vector.  */
 		  switches[n_switches].args[j] = 0;
 		}
-	      else if (strchr (switches_need_spaces, c))
+	      else if (c == 'o')
 		{
-		  /* On some systems, ld cannot handle some options without
+		  /* On some systems, ld cannot handle "-o" without
 		     a space.  So split the option from its argument.  */
 		  char *part1 = XNEWVEC (char, 2);
 		  part1[0] = c;
@@ -4779,9 +4765,9 @@  do_self_spec (const char *spec)
 	      /* Null-terminate the vector.  */
 	      sw->args[j] = 0;
 	    }
-	  else if (strchr (switches_need_spaces, c))
+	  else if (c == 'o')
 	    {
-	      /* On some systems, ld cannot handle some options without
+	      /* On some systems, ld cannot handle "-o" without
 		 a space.  So split the option from its argument.  */
 	      char *part1 = XNEWVEC (char, 2);
 	      part1[0] = c;
diff -rupN --exclude=.svn gcc-mainline-opt5-single-pass/gcc/system.h gcc-mainline/gcc/system.h
--- gcc-mainline-opt5-single-pass/gcc/system.h	2010-06-25 06:15:53.000000000 -0700
+++ gcc-mainline/gcc/system.h	2010-06-26 06:21:01.000000000 -0700
@@ -769,7 +769,7 @@  extern void fancy_abort (const char *, i
 	ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE			   \
 	STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD		   \
 	ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE		   \
-	ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME
+	ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\