On Tue, 13 Dec 2011, SF Markus Elfring wrote:

It processes .h files. It doesn't know whether a .h file is C code or C++ code.

I hope that the preprocessor definitions would be set and processed in a similar way like a C compiler would do it during source code analysis.

It's a matter of opinion. With your strategy, it would not be possible to write rules that match on uses of macros. This can be quite useful, especially in the case of named constants, eg #define DONE 0.

The definitions of preprocessor symbols are not ignored. They can be matched against. But there has been no change in the extent to which the definition is
propagated to the use.

I assume that the command "spatch" tries to include more header files than are really needed for my test case.

It doesn't know what is needed. You can control the degree of effort it puts into finding the files, but that is quite coarse-grained.

In general, if the parsing of something fails, it moves on to the next thing.

Is it possible to let the tool stop after a failure immediately?

No, nothing is planned for that. It would be undesirable, because many files fail in some way, due to the various include strategies. If you want feedback about the degree to which you code can be parsed, you can use the -parse_c option, perhaps additionally with -verbose_parsing, if you want more information.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to