This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: adding GGC events for plugins.
Hello All
Richard Guenther wrote:
* testsuite/gcc.dg/plugin/plugin.exp: Added ggcplug.c test plugin
with ggcplug-test-1.c for testing PLUGIN_GGC_MARKING etc...
* testsuite/gcc.dg/plugin/ggcplug-test-1.c: Added new file.
* testsuite/gcc.dg/plugin/ggcplug.c: Added new file.
this belongs to testsuite/ChangeLog. It doesn't build for me:
The attached patch (in the testsuite only) to trunk rev148014 seems to
make the test pass by running
make check-gcc RUNTESTFLAGS="plugin.exp"
[I hope it is the correct way to run a test]
in the build dir after a make
gcc/testsuite/ChangeLog
* gcc.dg/plugin/ggcplug.c: moved comment.
(plugin_init): fixed typo, declared i, returned 0 at end.
Regards, and apologies for the typos.
--
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 mines, sont seulement les miennes} ***
Index: gcc/testsuite/gcc.dg/plugin/ggcplug.c
===================================================================
--- gcc/testsuite/gcc.dg/plugin/ggcplug.c (revision 148014)
+++ gcc/testsuite/gcc.dg/plugin/ggcplug.c (working copy)
@@ -14,12 +14,7 @@
#include "gcc-plugin.h"
-/* The initialization routine exposed to and called by GCC. The spec of this
- function is defined in gcc/gcc-plugin.h.
- Note that this function needs to be named exactly "plugin_init". */
-
-
/* our callback is the same for all PLUGIN_GGC_START,
PLUGIN_GGC_MARKING, PLUGIN_GGC_END events; it just increments the
user_data which is an int */
@@ -35,12 +30,18 @@ static const struct ggc_root_tab our_xtratab[] = {
LAST_GGC_ROOT_TAB
};
+
+/* The initialization routine exposed to and called by GCC. The spec of this
+ function is defined in gcc/gcc-plugin.h.
+
+ Note that this function needs to be named exactly "plugin_init". */
int
-plugin_init ((struct plugin_name_args *plugin_info,
+plugin_init (struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
const char *plugin_name = plugin_info->base_name;
int argc = plugin_info->argc;
+ int i = 0;
struct plugin_argument *argv = plugin_info->argv;
if (!plugin_default_version_check (version, version))
return 1;
@@ -97,7 +98,9 @@ int
(void *) our_xtratab);
}
}
-}
+ /* plugin initialization succeeded */
+ return 0;
+ }
static void
increment_callback (void *gcc_data, void *user_data)