Command Line Options

The only required argument for all commands using “undc” is the project database file. The following table lists the command line options for “undc”.

Option
Description
-a[dd] file [files]
-a[dd] @filelist.txt
Specify one or more files to add to the database. Files can be specified in two ways:
  • Individually: Separate filenames with spaces. For example -add *.h *.c adds all *.h and *.c files in the current directory to the project. Absolute paths are used. For relative paths, use the -reladd option.
  • In a text file: Use -add @filelist.txt to add all files that are listed in that file to the project. The file must contain one file per line. Full or relative paths may be used. Relative paths are relative to the project file. A # sign in the first column of a line in the listfile indicates a comment. The file’s contents are evaluated one time only. If you want the file’s contents to be evaluated each time the project is analyzed, use @@filelist.txt.
This option may be used multiple times on the same command line.
-addfoundincludes
Automatically adds any files found via the #include mechanism to the project. This means more detailed information will be available about the entities provided from those files. Use this option with care, as it could make the database much larger than needed.
-autoinclude [files]
Specify include files to include before each file in a project.
-compiler compilername
Specify the compiler to use. To remove the current compiler, use -compiler none. For a list of valid compiler names, use -compiler list.
-create [project file]
Create a new project. Creating a new database overwrites an existing database of the same name. When you use this option, filenames specified on the command line are treated as if they were used with the -add option (to add them to the project).
-db database
Specify the name of the database to create or open. An extension of .udc is provided if no extension is given.
-define definition @definitionfile
Defines a macro which is then saved to the project database for subsequent runs. This is an optional argument which may be used multiple times on the same command line.

A definition prefaced by @ may be used to specify a file that contains macro definitions of the form:
#define foo bar
foo=bar
foo bar
which all define a macro “foo” as “bar”
-d[elete] file [files]
-d[elete] @filelist.txt
Specify one or more files to delete from the database. Wildcards are permitted. Files can be specified in two ways: individually (separated by spaces) or in a text file with one file per line.
For example -delete *.h *.c removes all *.h and *.c files in the current directory from the project. Or use -delete @filelist.txt to delete all files that are listed in that file to the project. The file must contain one file per line. Full or relative paths may be used. Relative paths are relative to the project file. A # sign in the first column of a line in the listfile indicates a comment.
This option may be used multiple times on the same command line.
-error file
Specify a file to which error messages should be logged. If omitted then errors are sent to the standard error destination.
-h[elp]
Show the command line options.
-include includes @includes
An optional argument to add a path to the analysis include path. This include path will be saved in your project database file. This argument may be specified multiple times on the same command line

A file prefaced by @ can be used to list include directories (one per line).
-list_files
Outputs to the screen the list of source files configured in the project. Useful for as input to the “-add” option for recreating a project.
-list_defines
Outputs to the screen the list of macros defined in the project. Useful as input to the -defines option for recreating a project.
-list_includes
Outputs to the screen the list of include paths configured in the project. Useful as input to the
-includes option for recreating a projects configuration.
-list_undefines
Outputs to the screen the list of macros undefined in the project.
-msvc_add {project_file} {target_name}
Adds files to a project from an MSVC project. It is for one-time use.
-msvc_sync {project_file} {target_name}
Adds files to a project from an MSVC project and continue synching the project to the MSVC project.
-no_cache
Turns off the C-preprocessor include cache. The include cache remembers what has been included and reuses information if that include is encountered. This trades memory for speed, but memory use can grow large. In some situations, particularly in large projects or on memory limited machines it may be better to turn the cache off. Note that there are also situations where turning the include cache on or off can affect analysis results, particularly where include actions are dependent on where they are included.
-no_system_as_user_include
By default, the parser looks for system includes (surrounded by <>) using same strategies as normal includes (surrounded by quotes). If this option is turned off, the parser looks for system includes only in directories defined in the compiler configuration.
-quiet
Use for quiet processing, i.e. status messages will not be written to the screen. This argument is optional. By default, some status messages are written to standard output.
-rebuild
Performs a full reparse of all project source files whether they have been modified or not.
-refresh
Performs an incremental reparse of the project source files. Only modified and dependent files are re-parsed. This is the default action when no other option is specified. If project parameters have changed since the last build, be sure to use -rebuild instead of -refresh.
-reladd
Add a relative source file reference to a project.
-rellist_files
List source files with relative references.
-terse
Report only errors and warnings. Do no list each file being parsed.
-undefine definition
Undefines a macro which is then saved to the project database for subsequent runs. This is an optional argument which may be used multiple times on the same command line.
-v[erbose]
Use for verbose processing, i.e. status messages will be written to the screen. This argument is optional.

The following sections show example uses of undc.


Scientific Toolworks, Inc.
http://www.scitools.com