This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Plugin that parse tree
- From: Daniel Marjamäki <daniel dot marjamaki at gmail dot com>
- To: piervit at pvittet dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 24 Jan 2011 16:28:06 +0100
- Subject: Re: Plugin that parse tree
- References: <ed10e8adfd7ebb41d2f361b2a06c2e11@localhost> <95f62d57256fbc424a68e891a679b390@localhost>
Do you have any opinion about adding a warning for:
int f(char c)
{
return 10 * (c == 13) ? 1 : 2;
}
The multiplication has no effect. The function returns either 1 or 2.
It would be interesting to know how a MELT script could look like for
such a case.
As far as I see the multiplication doesn't exist in the gimple format
(looking at a.c.004t.gimple generated by -fdump-tree-all).