This is the mail archive of the 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]

customizable warnings with a GCC plugin


My name is Pierre Vittet and my GSOC application as been selected. My project is about writing a plugin allowing GCC users to add some simple warnings, being useful in their particular project.
The user should be able to add rules like "when I got a call to a foo function, I would like to be sure that a check is made to monitor that it doesn't return somethings null" or "when I call this foo function, I would like it to be followed by that bar function". I will use MELT in order to realize this plugin.

You can read the detail of my application here: .

I have also started a page on the GCC wiki, it is pretty empty for now but is going to grow with the project: .

For now, I am able to write simple plugins, two exemples can be found here ( However, that is still difficult to test them on real size programs. Mainly because it can be difficult to build a complete program using GCC MELT (the branch). For exemple GCC MELT has mainly been tested on C programs, so if there is a C++ part, it mights fails, I have got also some problems when the configure scripts had to check GCCMELT. There is a fresh release of MELT as a plugin which will simplify things, I am going to report few issues coming from it. I think MELT is improving , and I am confident in being able to compile on real programs (I could already build readline for exemple).

So, I will be ready to start real coding of the plugin for the GSOC starting date (Mai 23).
For the moment I would like to give the following monitoring opportunity to the user:

- Checking that the returned value of a call to foo function is tested to be (not) NULL.
- Checking that the returned value of a call to foo function is tested to be (not) negative.
- Checking that the returned value of a call to foo function is tested to be (not) zero.
- Checking that a call to foo is immediately followed by a call to the bar function.
- Checking that a call to foo is followed in the same function by a call to the bar function.

My checks are limited to a function because I am going to work at the GIMPLE representation, and pass are run successively for each function. I am not sure that MELT is ready for IPA pass (or that might be experimental work). There is sufficient things to do with GIMPLE pass.

Do you see any others interesting cases to check?

Another big question: For this type of plugin, what would be the best position to insert my pass. For now, I try to add it just after the SSA pass and as it worked, I keep it at the position. Is it a good choice? I need a pass which is always run (or my plugin will not be inserted) and which has a correct GIMPLE representation.

I guess the most difficult point of my project might be to organise how my pass will run the different checks. The user will have the opportunity to run different checks in one compilation. I could choice to make one pass for every checks.
This would mean to have a first pass that parse the arguments and set the others pass (Is it possible to create new pass while we are already in one pass ?).

The others idea would be to have just one big pass, which is able to run for each GIMPLE statement the different checks in parallel. I am not sure that would be really nice.
What is your opinion on this?

If you have feedbacks from what is given here, I would enjoy to read them. If you have some documentation which could be related to the pass organisation (I already had a look at the very good GCC tutorial from Albert Cohen ( or to anything looking interesting for my project, it would be great.

Thanks for your reading, I hope my English is not so bad.

Pierre Vittet

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