This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PLUGIN] Fix PLUGIN_FINISH_TYPE
- From: Dodji Seketeli <dodji at seketeli dot org>
- To: Romain Geissler <romain dot geissler at st dot com>
- Cc: "gcc-patches\ at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Mon, 12 Sep 2011 16:54:55 +0200
- Subject: Re: [PLUGIN] Fix PLUGIN_FINISH_TYPE
- References: <4E6DBC5F.6070408@st.com>
Hello Romain,
Romain Geissler <romain.geissler@st.com> a Ãcrit:
> This patch solves some lacks with the PLUGIN_FINISH_TYPE event
> triggering. For now, both C and C++ parser won't trigger it for enums or
> for typedef.
AFAICT, typedef declarations are reported by the PLUGIN_FINISH_DECL
event. The predicate is_typedef_decl then returns TRUE when passed the
decl carried by the event. Maybe the plugin's documentation could use
an addendum for this.
[...]
> gcc/cp/
> 2011-09-12 Romain Geissler <romain.geissler@gmail.com>
>
> * decl.c (grokdeclarator): Trigger PLUGIN_FINISH_TYPE for typedefs.
[...]
> Index: gcc/cp/decl.c
> ===================================================================
> --- gcc/cp/decl.c (revision 178252)
> +++ gcc/cp/decl.c (working copy)
> @@ -9682,6 +9682,9 @@ grokdeclarator (const cp_declarator *dec
> memfn_quals != TYPE_UNQUALIFIED,
> inlinep, friendp, raises != NULL_TREE);
>
> + if (TREE_TYPE (decl) != error_mark_node && !DECL_ARTIFICIAL (decl))
> + invoke_plugin_callbacks (PLUGIN_FINISH_TYPE, decl);
> +
> return decl;
> }
>
So I think this change is not necessary.
[...]
> Index: gcc/testsuite/gcc.dg/plugin/dumb-plugin-test-1.c
> ===================================================================
> --- gcc/testsuite/gcc.dg/plugin/dumb-plugin-test-1.c (revision 0)
> +++ gcc/testsuite/gcc.dg/plugin/dumb-plugin-test-1.c (revision 0)
> @@ -0,0 +1,56 @@
> +// Test case for the dumb plugin.
> +// { dg-do compile }
> +// { dg-options "-O -fplugin-arg-dumb_plugin-ref-pass-name=ccp -fplugin-arg-dumb_plugin-ref-pass-instance-num=1" }
> +
Here, it would be nice to add a comment saying which plugin acts on this
plugin's test and what the plugin does (what the output is supposed to
be). That redundant information eases the review, at very least.
Thanks.
--
Dodji