SV: SV: [Cocci] adding #include's
julia at diku.dk
Thu Nov 5 14:05:39 CET 2009
On Thu, 5 Nov 2009, Andreas.Aaen at tieto.com wrote:
> Nicolas Palix wrote:
> > So, you need to ensure that foo is not already there..
> > @ depends on !s && !r @
> Exactly. I just realized this and wanted to write it to the mailing list. Gosh you are fast on this list :-)
> #include <foo.h>
> @ s depends on never r @
> #include <bar.h>
> +#include <foo.h>
> @ depends on never r && never s @
> So what missing now is a rule to insert #include <foo.h> in a file without any #include statements. For my real world tasks I can live without this.
Unfortunately, that is not currently possible. It has to know what to
insert the thing before or after. If you happened to know the name of the
first function in the file, you could of course put it there, but that is
not a very general solution.
More information about the Cocci