[cfe-dev] User documentation for supported warnings and --analyze mode

Chris Lattner clattner at apple.com
Sat Mar 5 08:08:12 PST 2011


On Mar 3, 2011, at 10:59 AM, Sean McBride wrote:

>> Sounds completely reasonable.  Unfortunately, documentation on either is
>> completely lacking at this point.
> 
> That's a real shame because one of clang's greatest advantages over gcc
> is it's warnings.  I've often wondered if there's some great warning
> flags that could help me that I haven't turned on because I just don't
> know about them. :(
> 
> Is there a -Wall-and-I-mean-really-all ?  If so, combined with -
> fdiagnostics-show-option, one could start with everything and weed out
> ones considered too noisy.

Hi Sean,

All of the clang warning flags are maintained in ".td" files in clang/include/clang/Basic. Something that has been on my todo list for a very long time (but isn't likely to get tackled anytime soon) is to put descriptive text into the .td files for each flag... both a single line description suitable for -help output, and a full-on paragraph describing its use for the HTML manual and a man page.

The idea is that the clang binary (when passed --help, and some new flag) could then self describe the warning flags that it takes.  I would actually really like to make the "clang --help" be a multilevel tool like the lldb console help system, so that you could have "clang --help warnings" for example to dive into various subsections of the help output, or "clang --help all" if you just want to grep through a giant dump of output.

If anyone is interested in this, it would make a very straight-forward "getting started with clang" project.

-Chris



More information about the cfe-dev mailing list