Safety Check Usage

During the course of development, there may be times when a non-threadsafe type of code must be used. You can mark source code with an explanation about why the non-threadsafe code exists. Safety Check will then display this information as part of its run. To mark source code with an exception, include a comment in this format: /*_LRBF <comment text */. The comment must begin with "/*_LRBF." The remainder of the comment can span multiple lines and include any other necessary text. The entire comment will print as part of Safety Check output.

You control Safety Check functionality through several options, at least one of which must be supplied. Multiple options are supported. Quotation marks are required only when the path specified contains spaces. For example, if the single C source file b1234.c is stored in the "c:\source" directory, you could call SafetyCheck in one of two ways: SafetyCheck --F c:\source\b1234.c or SafetyCheck --F "c:\source\b1234.c" However, if the same C source file is stored in the "c:\test files", you must enclose the path/filename in quotations: SafetyCheck --F "c:\test files\b1234.c"

Argument

Usage

--F<C source file>

Use to check a single C source file, for example, --F c:\test\b1234.c

--I<Header file>

Use to check a single header file, for example, --I c:\include\b1234.h

--FD<C source directory>

Use to check all C source files in a given directory, for example, --FD c:\my project\source.

Note: Do not include a trailing slash as part of the directory argument.

--ID<Header file directory>

Use to check all header files in a given directory, for example --ID c:\my project\include

Note: Do not include a trailing slash as part of the directory argument.

--P<Project file>

Use to create a text file that contains a list of files, each of which will be scanned by Safety Check. The project file should contain multiple lines of the form: SOURCE=<fully qualified file name>

Note: Do not use quotation marks in the project file.

For example, a project file that specifies three files to scan could look like this:

SOURCE=c:\my project\source\b1111.c

SOURCE=c:\my project\source\b2222.c

SOURCE=c:\my project\include\main.h

--csv

Use to produce output in a comma-delimited format. The output will contain these elements:

  • File (the fully qualified file name)

  • Line (the line number of the erroneous code)

  • Global (1 if a global was found, 0 if not.)

  • Static (1 if a static was found, 0 if not.)

  • Extern (1 if an external declaration was found, 0 if not.)

  • API (1 if a non-threadsafe API was found, 0 if not.)

  • BraceMismatch (1 if scanning could not complete due to a brace mismatch)

  • Exception (1 if an exception comment was found, 0 if not.)

  • CouldNotOpen (1 if the file could not be opened, 0 if it could.)

  • NotCSource (1 if the file name did not end in either ".c" or ".h")

  • C++Comment (1 if a C++ style comment was found)

  • CapInclude (1 if a capital letter was used in a #include)

  • LastChar (1 if the last character was not a new line character)

  • CommentInComment (1 if a comment was found inside a comment)

--X

Select to print a warning message when a file to check is specified that does not end in "c" or "h". By default, these warning messages are hidden.