CCA is a cyclomatic complexity analyzer that gives a rough approximation to the logarithm of the complexity of the functions in a source program whose name is specified on the command line.

The command line options allow you to tweak the algorithm slightly.

CCA reads C++ files and produces a cyclomatic complexity metric for the functions in the files and for the file as a whole. Options control the logging detail.

It reads a list of files whose names appear on the command line. Or from stdin. It assumes that these files are C++ source files and it produces output naming the namespaces, classes, structs, enums, and functions defined in those files -- and on which line they can be found.

Note that the parser found here is meant to parse C++ files with bad syntax, not just properly formatted files. It does not attempt to preprocess the input files -- thus if you do sneaking macro magic it might get confused -- on the other hand, it is very tolerant of the kind of macro magic that one normally sees. For example:

 #ifdef __cplusplus
 extern "C" {
 #endif
 int f;
 #ifdef __cplusplus
 }
 #endif

Note that since this program doesn't use the C preprocessor, the #if's endifs, and macro names are actually parsed by the program. Thus the parser itself has to be very tolerant of extraneous tokens in the stream. So instead of just parsing a variable declaration that looks like this:

    typename varname ;

It must handle this syntax:

    trash trash trash varname ;

Extraneous {, }, etc are just ignored.

Most of the handling for extraneous tokens is done in parse_funcvar(). On first glance, it seems to be handling 'typename varname' and 'typename funcname(parms) ...' syntax but actually it handles all the deviant syntaxes as well.

Generated on Wed Feb 29 22:51:48 2012 for CXXUtilities by  doxygen 1.6.3