Sparse is not meant to be lint, for example. Sparse is designed to create a parsing tree for arbitrary code so that it can be further analyzed.
In your example, you either want to define GNU_SOURCE (which I suppose __GNUC__ is included) that provides the bit you need in limits.h
I would not independently determine __GNUC__, since several of the actions that it activates can behave as undefined without all the other switches that GNU_SOURCE turns on.
My point is not to help you make a squash mistake by mistake, to repeat that sparse is mainly used as a library, and not as a standalone static analysis tool.
From my copy of README (not sure if I have the current version):
This means that a user of the library will literally just need to do struct string_list *filelist = NULL; char *file; action(sparse_initialize(argc, argv, filelist)); FOR_EACH_PTR_NOTAG(filelist, file) { action(sparse(file)); } END_FOR_EACH_PTR_NOTAG(file); and he is now done - having a full C parse of the file he opened. The library doesn't need any more setup, and once done does not impose any more requirements. The user is free to do whatever he wants with the parse tree that got built up, and needs not worry about the library ever again. There is no extra state, there are no parser callbacks, there is only the parse tree that is described by the header files. The action function takes a pointer to a symbol_list and does whatever it likes with it. The library also contains (as an example user) a few clients that do the preprocessing, parsing and type evaluation and just print out the results. These clients were done to verify and debug the library, and also as trivial examples of what you can do with the parse tree once it is formed, so that users can see how the tree is organized.
Incoming clients are more “functional test suites and examples” than anything. This is a very useful tool, but you can consider a different angle of use if you want to use it. I like it because it does not use * lex / bison, which makes it a lot easier to crack.
source share