Patchwork PATCH: adding invoking_program to plugin_gcc_version

login
register
mail settings
Submitter Basile Starynkevitch
Date June 1, 2011, 6:05 a.m.
Message ID <20110601080540.27d8762b.basile@starynkevitch.net>
Download mbox | patch
Permalink /patch/98124/
State New
Headers show

Comments

Basile Starynkevitch - June 1, 2011, 6:05 a.m.
On Wed, 1 Jun 2011 07:52:48 +0200
Basile Starynkevitch <basile@starynkevitch.net> wrote:

> 
> Hello All,
> 
> The attached patch to trunk 174518 adds a field invoking_program to the
> plugin_gcc_version structure. It informs the plugin about the program
> "cc1", "cc1plus", "lto1" using them.

Wrong patch, here is a better one

######### gcc/ChangeLog entry ##########
2011-06-01  Basile Starynkevitch  <basile@starynkevitch.net>

	* gcc-plugin.h (struct plugin_gcc_version): Add invoking_program field.

	* configure.ac: Ditto.

	* configure: Regenerate.

	* plugin.c (initialize_plugins): Set invoking_program.

########################################

Ok if it bootstraps?

Cheers
Richard Guenther - June 1, 2011, 9:20 a.m.
On Wed, Jun 1, 2011 at 8:05 AM, Basile Starynkevitch
<basile@starynkevitch.net> wrote:
> On Wed, 1 Jun 2011 07:52:48 +0200
> Basile Starynkevitch <basile@starynkevitch.net> wrote:
>
>>
>> Hello All,
>>
>> The attached patch to trunk 174518 adds a field invoking_program to the
>> plugin_gcc_version structure. It informs the plugin about the program
>> "cc1", "cc1plus", "lto1" using them.
>
> Wrong patch, here is a better one
>
> ######### gcc/ChangeLog entry ##########
> 2011-06-01  Basile Starynkevitch  <basile@starynkevitch.net>
>
>        * gcc-plugin.h (struct plugin_gcc_version): Add invoking_program field.
>
>        * configure.ac: Ditto.
>
>        * configure: Regenerate.
>
>        * plugin.c (initialize_plugins): Set invoking_program.
>
> ########################################
>
> Ok if it bootstraps?

It's redundant information with lang_hooks.name.  So, NO!  (yes,
again, no!)

Richard.

> 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} ***
>

Patch

Index: gcc/configure
===================================================================
--- gcc/configure	(revision 174518)
+++ gcc/configure	(working copy)
@@ -10977,7 +10977,9 @@  static char revision[] = "$gcc_REVISION";
 
 static struct plugin_gcc_version gcc_version = {basever, datestamp,
 						devphase, revision,
-						configuration_arguments};
+						configuration_arguments,
+/* Field invoking_program is set in general_init inside toplev.c.  */
+						NULL};
 EOF
 
 # Internationalization
@@ -17517,7 +17519,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17520 "configure"
+#line 17522 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17623,7 +17625,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17626 "configure"
+#line 17628 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 174518)
+++ gcc/configure.ac	(working copy)
@@ -1521,7 +1521,9 @@  static char revision[] = "$gcc_REVISION";
 
 static struct plugin_gcc_version gcc_version = {basever, datestamp,
 						devphase, revision,
-						configuration_arguments};
+						configuration_arguments,
+/* Field invoking_program is set in general_init inside toplev.c.  */
+						NULL};
 EOF
 changequote([,])dnl
 
Index: gcc/gcc-plugin.h
===================================================================
--- gcc/gcc-plugin.h	(revision 174518)
+++ gcc/gcc-plugin.h	(working copy)
@@ -70,6 +70,8 @@  struct plugin_gcc_version
   const char *devphase;
   const char *revision;
   const char *configuration_arguments;
+  /* Short string like "cc1" or "lto1" giving the invoking program.  */
+  const char *invoking_program;
 };
 
 /* Object that keeps track of the plugin name and its arguments. */
Index: gcc/plugin.c
===================================================================
--- gcc/plugin.c	(revision 174518)
+++ gcc/plugin.c	(working copy)
@@ -632,6 +632,7 @@  initialize_plugins (void)
   timevar_push (TV_PLUGIN_INIT);
 
 #ifdef ENABLE_PLUGIN
+  gcc_version.invoking_program = progname;
   /* Traverse and initialize each plugin specified in the command-line.  */
   htab_traverse_noresize (plugin_name_args_tab, init_one_plugin, NULL);
 #endif