SV: [Cocci] Putting a specific #include first

Julia Lawall julia at diku.dk
Tue Nov 17 15:39:45 CET 2009


On Tue, 17 Nov 2009, Andreas.Aaen at tieto.com wrote:

> A maybe more lelgant way to put a specific include statement first could be:
> 
> -----------------------
> @x@
> @@
> +#include <xxxxxxxxstd.h>
> #include <...>
> @depends on x@
> @@
> -#include <std.h>
> @depends on x@
> @@
> +#include <std.h>
> -#include <xxxxxxxxstd.h>
> -------------------------
> 
> This should move #include <std.h> to the top. The trick is to add a temporary include statement at the top position and then rename it as the last rule.

Yes, that seems ok.

julia


More information about the Cocci mailing list