Hello All,

It should be perfectly possible for a plugin argument to contain the
equal sign.

For plugin with scripting or DSL behavior (like MELT, see
http://gcc-melt.org/ for more) it is useful to pass some commands 
or expressions to the plugin. For MELT we might want to run
 
     gcc -fplugin=melt -fplugin-arg-melt-mode=eval \
         -fplugin-arg-melt-arg='(== 1 2)' empty.c

for plugins accepting some shell command to be run by system or popen, 
passing -fplugin-arg-foo-command='env FOO=bar doit arg' would be
perfectly ok, but is not.

The small attached patch relative to trunk 201571 should solve the
issue.

##### gcc/ChangeLog entry
2013-08-07  Basile Starynkevitch  <bas...@starynkevitch.net>

        * plugin.c (parse_plugin_arg_opt): Accept equal sign inside 
          plugin argument.
####

Comments are welcome. Ok for trunk?

Cheers

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Index: gcc/plugin.c
===================================================================
--- gcc/plugin.c	(revision 201571)
+++ gcc/plugin.c	(working copy)
@@ -241,16 +241,13 @@ parse_plugin_arg_opt (const char *arg)
         }
       else if (*ptr == '=')
         {
-          if (key_parsed)
-            {
-              error ("malformed option -fplugin-arg-%s (multiple '=' signs)",
-		     arg);
-              return;
-            }
-          key_len = len;
-          len = 0;
-          value_start = ptr + 1;
-          key_parsed = true;
+	  if (!key_parsed) 
+	    {
+	      key_len = len;
+	      len = 0;
+	      value_start = ptr + 1;
+	      key_parsed = true;
+	    }
           continue;
         }
       else

Reply via email to