cflow - Man Page
generate a C-language flowgraph
Synopsis
cflow [-ADIPSTUabdfilmnopqrsvx] [-D NAME[=DEFN]] [-I DIR] [-P DIR] [-U NAME] [-d NUMBER] [-f NAME] [-i CLASSES] [-m NAME] [-o FILE] [-p NUMBER] [-s SYMBOL:[=]TYPE] [--all] [--[no-]ansi] [--[no-]brief] [--cpp=COMMAND] [--debug=[NUMBER]] [--define=NAME[=DEFN]] [--depth=NUMBER] [--[no-]emacs] [--format=NAME] [--include=CLASSES] [--include-dir=DIR] [--level-indent=ELEMENT] [--main=NAME] [--no-cpp] [--no-main] [--no-preprocess] [--[no-]number] [--[no-]omit-arguments] [--[no-]omit-symbol-names] [--output=FILE] [--prepend-path=DIR] [--preprocess=[COMMAND]] [--[no-]print-level] [--profile=FILE] [--pushdown=NUMBER] [--[no-]reverse] [--start=NAME] [--symbol=SYMBOL:[=]TYPE] [--target=NAME] [--[no-]tree] [--undefine=NAME] [--[no-]use-indentation] [--[no-]verbose] [--xref] [FILE]...
Note
This manpage is a short description of GNU cflow. For a detailed discussion, including examples and usage recommendations, refer to the GNU Cflow Manual available in texinfo format. If the info reader and the cflow documentation are properly installed on your system, the command
info cflow
should give you access to the complete manual.
You can also view the manual using the info mode in emacs(1), or find it in various formats online at
If any discrepancies occur between this manpage and the GNU Cflow Manual, the later shall be considered the authoritative source.
Description
Cflow analyzes a collection of input files written in C programming language and writes to standard output a graph charting dependencies between various functions.
Options
General-purpose options
- -d, --depth=NUMBER
Set the depth at which the flowgraph is cut off. By default the depth is not limited.
- --debug[=NUMBER]
Set debugging level.
- -f, --format=NAME
Use given output format NAME. Valid names are dot (DOT language), gnu (the default) and posix.
- -i, --include=CLASSES
Include specified classes of symbols. The ^or- symbol excludes the classes that follow it. Valid classes are:
- _ (underscore)
Symbols whose names begin with an underscore.
- s
Static symbols
- t
Typedefs (for cross-references only).
- x
All data symbols, both external and static
- -o, --output=FILE
Set output file name (default is -, meaning stdout).
- -r, --[no-]reverse
Print (don't print) reverse call tree.
- -x, --xref
Produce cross-reference listing only.
- -v, --verbose
Enable verbose error diagnostics.
- --no-verbose
Cancel effect of any prior --verbose options.
Program initialization
These options manipulate cflow profiles. A profile is a set of cflow options intended to be applied together. Profiles are used, among others, to provide settings for specific versions of the C language.
Each profile is given a unique name and stored in a file named NAME.cfo located in profile search path. The default search path is determined at compile time, and normally consists of the following directories:
- ~/.cflow.d
(~/ stands for the user home directory)
- /usr/share/cflow/site-init
- /usr/share/cflow/VERSION
(VERSION is the version of cflow)
Examine the output of the cflow --help command, to obtain the search path used by your version of cflow.
- -P, --prepend-path=DIR
Add DIR at the beginning of the profile search path.
- --profile=NAME
Read options from the named profile. A profile is a text file containing a set of cflow options. This option causes lookup of the file NAME.cfo in profile search path. The file is read, and all options from it processed as though they appeared in that point of the command line.
- -q
Don't load default profile.
Default profile is stored in file default.cfo, located in the search path. Unless the -q option is given, that file is processed at startup.
Parser control
- -a, --ansi
Accept only sources in ANSI C.
- --no-ansi
Don't assume input files are written in ANSI C.
- -D, --define=NAME[=DEFN]
Predefine NAME as a macro.
- -I, --include-dir=DIR
Add the directory DIR to the list of directories to be searched for header files.
- -p, --pushdown=NUMBER
Set initial token stack size to NUMBER.
- --preprocess[=COMMAND], --cpp[=COMMAND]
Run the specified preprocessor command.
- --no-preprocess, --no-cpp
Disable preprocessing.
- -s, --symbol=SYMBOL:[=]TYPE
Register SYMBOL with given TYPE, or define an alias (if := is used). Valid types are: keyword (or kw), modifier, qualifier, identifier, type, wrapper, and declaration. Any unambiguous abbreviation of the above is also accepted.
- -S, --use-indentation
Rely on indentation to solve suspicious constructs.
- --no-use-indentation
Don't use indentation in parsing (default).
- --target=NAME
Show only graphs leading from start symbols to this function; multiple options are allowed.
- -U, --undefine=NAME
Cancel any previous definition of NAME.
Output control
- -A, --all
Produce graphs for all global functions in the program. Use this option if your program contains functions which are not directly reachable from main().
Output consists of separate flow graphs for each top-level function defined in the program. These graphs will be placed after the graph for main() (if it exists), and will be ordered lexicographically by the function name.
If used twice, graphs for all global functions (whether top-level or not) will be displayed.
- -b, --brief
Brief output.
- --no-brief
Disable brief output.
- --emacs
Format output for use with GNU Emacs.
- --no-emacs
Disable the effect of the previous --emacs option.
- -l, --print-level
Print nesting level along with the call tree.
- --no-print-level
Don't print nesting level.
- --level-indent=ELEMENT
Control graph appearance.
- -m, --main=NAME
Assume main function is NAME. This option can be given multiple times. A separate graph will be drawn for each function given as its argument.
- --no-main
Assume there's no main function in the program. This option has the same effect as --all, except that, if the program do define the main function, it will be treated as any other functions, i.e. it will not be placed at the top of output, but in its place as per the lexicographic ordering of function names. See also the description of --all.
- -n, --number
Print line numbers.
- --no-number
Don't print line numbers.
- --omit-arguments
Do not print argument lists in function declarations.
- --no-omit-arguments
Print argument lists in function declarations (the default).
- --omit-symbol-names
Do not print symbol names in declaration strings.
- --no-omit-symbol-names
Print symbol names in declaration strings (the default).
- -T, --tree
Draw ASCII art tree.
- --no-tree
Disable tree output.
Informational options
These options instruct the program to output the requested piece of information and exit.
- -?, --help
Print a short help summary.
- --usage
Print a summary of available options.
- -V, --version
Print program version.
Return Value
- 0
Successful completion.
- 1
Fatal error occurred.
- 2
Some input files cannot be read or parsed.
- 3
Command line usage error.
See Also
Online copies of GNU cflow documentation in various formats can be found at:
Authors
Sergey Poznyakoff <gray@gnu.org>.
Bug Reports
Report bugs to <bug-cflow@gnu.org>.
Copyright
Copyright © 2014-2025 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.