5 ms·
You'd think a stand-alone program could take care of this quite nicely? No need to clutter the compiler itself.
by swehner 11y ago
You'd think a stand-alone program could take care of this quite nicely? No need to clutter the compiler itself.
- GFK_of_xmaspast 11y agoIt's hard enough to get people to turn on warnings in the first place.
- TorKlingberg 11y agoI have set up stand-alone static analyzers a couple of times, and it can be a giant hassle to get them working correctly. It is especially bad with complicated build systems for embedded applications. To parse a C file correctly a tools needs to know the exact set of include path and defines you passed to the compiler. Then it needs to go read the whole tree of header files and preprocess everything. It needs to know where your standard header files are (different from the system header file when cross compiling). It needs to know about your compiler's built-in defines. It may also choke on any C extensions that your code (or any header file) is using. In this particular case it may be enough to parse the file with some regexes but I wouldn't trust it; people do some crazy things with C macros.