This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: MELT plugin: test fopen


Hello Pierre!

It is an interesting plugin. I'll keep an eye on your repository.

Thanks!
Daniel Marjamäki


2011/2/9 Pierre Vittet <piervit@pvittet.com>:
> Hello,
>
> I would like to present you a small plugin, which could be a good exemple of
> a MELT use case.
> This plugin allows to monitor that after every call to the fopen function,
> we have a test on the pointer returned by fopen (monitoring that it is not
> null).
>
> It creates a pass after SSA and works on gimple. It firstly matchs the
> gimple_call on fopen and save the tree corresponding to the FILE *. Then we
> check that the next instruction is a gimple_cond between the saved tree and
> the NULL ptr.
> When no test are found, the following error is returned:
> "test_fopen_cfile.c:35:11: warning: fopen not followed by a test on his
> returned pointer [enabled by default]"
>
> I think MELT is particulary adaptated when we have to match tree or gimples
> like I do here.
>
> For the moment I have only used it on small test file. I will try to see
> what it gives on a more realistic small to medium application.
>
> The code can be find on github: https://github.com/Piervit/GMWarn . The idea
> is to add more plugins. If you have some ideas or remarks, I am interested
> (however I still have to learn a lot from both GCC and MELT).
>
> If you try the code you will need to use the GCC MELT branch (or there is
> some changes to do in the Makefile to have it with MELT as plugin).
>
>
> Regards!
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]