public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Remove obsolete %[] specs operator
Date: Thu, 07 Jul 2011 09:04:00 -0000	[thread overview]
Message-ID: <CAFiYyc3dGr8Hz=6wxfEgWNCzLsmp8FtODzO4+tAnms0fHKJSoQ@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1107070002540.23355@digraph.polyomino.org.uk>

On Thu, Jul 7, 2011 at 2:03 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> The %[] spec operator is marked as obsolete and not used by any specs
> in GCC; I'm also not sure it would work properly now the canonical
> form of -D options is defined to have separate argument.  This patch
> removes support for that obsolete operator.
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  OK to
> commit?

Ok.

Thanks,
Richard.

> 2011-07-06  Joseph Myers  <joseph@codesourcery.com>
>
>        * gcc.c (%[Spec]): Don't document.
>        (struct spec_list): Update comment.
>        (do_spec_1): Don't handle %[Spec].
>        * doc/invoke.texi (%[@var{name}]): Remove documentation of spec.
>
> Index: gcc/doc/invoke.texi
> ===================================================================
> --- gcc/doc/invoke.texi (revision 175919)
> +++ gcc/doc/invoke.texi (working copy)
> @@ -9768,9 +9768,6 @@ Use this when inconsistent options are d
>  @item %(@var{name})
>  Substitute the contents of spec string @var{name} at this point.
>
> -@item %[@var{name}]
> -Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
> -
>  @item %x@{@var{option}@}
>  Accumulate an option for @samp{%X}.
>
> Index: gcc/gcc.c
> ===================================================================
> --- gcc/gcc.c   (revision 175919)
> +++ gcc/gcc.c   (working copy)
> @@ -438,7 +438,6 @@ or with constant text in a single argume
>           This may be combined with '.', '!', ',', '|', and '*' as above.
>
>  %(Spec) processes a specification defined in a specs file as *Spec:
> - %[Spec] as above, but put __ around -D arguments
>
>  The conditional text X in a %{S:X} or similar construct may contain
>  other nested % constructs or spaces, or even newlines.  They are
> @@ -1149,8 +1148,8 @@ static const char *multilib_dir;
>  static const char *multilib_os_dir;
>
>  /* Structure to keep track of the specs that have been defined so far.
> -   These are accessed using %(specname) or %[specname] in a compiler
> -   or link spec.  */
> +   These are accessed using %(specname) in a compiler or link
> +   spec.  */
>
>  struct spec_list
>  {
> @@ -5212,11 +5211,7 @@ do_spec_1 (const char *spec, int inswitc
>
>            /* Process a string found as the value of a spec given by name.
>               This feature allows individual machine descriptions
> -              to add and use their own specs.
> -              %[...] modifies -D options the way %P does;
> -              %(...) uses the spec unmodified.  */
> -         case '[':
> -           warning (0, "use of obsolete %%[ operator in specs");
> +              to add and use their own specs.  */
>          case '(':
>            {
>              const char *name = p;
> @@ -5225,7 +5220,7 @@ do_spec_1 (const char *spec, int inswitc
>
>              /* The string after the S/P is the name of a spec that is to be
>                 processed.  */
> -             while (*p && *p != ')' && *p != ']')
> +             while (*p && *p != ')')
>                p++;
>
>              /* See if it's in the list.  */
> @@ -5234,63 +5229,20 @@ do_spec_1 (const char *spec, int inswitc
>                  {
>                    name = *(sl->ptr_spec);
>  #ifdef DEBUG_SPECS
> -                   fnotice (stderr, "Processing spec %c%s%c, which is '%s'\n",
> -                           c, sl->name, (c == '(') ? ')' : ']', name);
> +                   fnotice (stderr, "Processing spec (%s), which is '%s'\n",
> +                            sl->name, name);
>  #endif
>                    break;
>                  }
>
>              if (sl)
>                {
> -                 if (c == '(')
> -                   {
> -                     value = do_spec_1 (name, 0, NULL);
> -                     if (value != 0)
> -                       return value;
> -                   }
> -                 else
> -                   {
> -                     char *x = (char *) alloca (strlen (name) * 2 + 1);
> -                     char *buf = x;
> -                     const char *y = name;
> -                     int flag = 0;
> -
> -                     /* Copy all of NAME into BUF, but put __ after
> -                        every -D and at the end of each arg.  */
> -                     while (1)
> -                       {
> -                         if (! strncmp (y, "-D", 2))
> -                           {
> -                             *x++ = '-';
> -                             *x++ = 'D';
> -                             *x++ = '_';
> -                             *x++ = '_';
> -                             y += 2;
> -                             flag = 1;
> -                             continue;
> -                           }
> -                         else if (flag
> -                                  && (*y == ' ' || *y == '\t' || *y == '='
> -                                      || *y == '}' || *y == 0))
> -                           {
> -                             *x++ = '_';
> -                             *x++ = '_';
> -                             flag = 0;
> -                           }
> -                         if (*y == 0)
> -                           break;
> -                         else
> -                           *x++ = *y++;
> -                       }
> -                     *x = 0;
> -
> -                     value = do_spec_1 (buf, 0, NULL);
> -                     if (value != 0)
> -                       return value;
> -                   }
> +                 value = do_spec_1 (name, 0, NULL);
> +                 if (value != 0)
> +                   return value;
>                }
>
> -             /* Discard the closing paren or bracket.  */
> +             /* Discard the closing paren.  */
>              if (*p)
>                p++;
>            }
>
> --
> Joseph S. Myers
> joseph@codesourcery.com
>

      reply	other threads:[~2011-07-07  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07  2:26 Joseph S. Myers
2011-07-07  9:04 ` Richard Guenther [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc3dGr8Hz=6wxfEgWNCzLsmp8FtODzO4+tAnms0fHKJSoQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=joseph@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).