Skip to main content

IAR Embedded Workbench for Arm 10.10.x

The C-STAT configuration file

このセクションの内容:

The configuration file specifies all options that C-STAT needs for the analysis, along with a set of rules to match files and checks using regular expressions and globs.

Syntax
Settings:
  Timeout: integer
  EnableFalsePositives: Boolean
  RunLinkAnalysis: Boolean
  MatchAgainstProjectPaths: Boolean
  MessageLimit: integer
  ExtraOptions: string
  OutputDir: path
Rules:
  - PathMatch: regexp
    Add:
      - glob
     [...]
    [Remove:
      - glob
      ...]
  [...]
Syntactical elements

Timeout

See ‑‑timeout.

EnableFalsePositives

See ‑‑fpe.

RunLinkAnalysis

See the description of the option Run link analysis in C-STAT Tools Options.

MatchAgainstProjectPaths

The C-STAT configuration file uses the PathMatch regular expression pattern to determine which files to analyze. This setting specifies whether to match against the project structure or not. If set to false, it will match against the files on disk.

MessageLimit

See the description of the option Limit messages in C-STAT Tools Options.

ExtraOptions

See 追加オプション.

OutputDir

See the description of the option Output directory in C-STAT Tools Options.

PathMatch

Specifies a regular expression pattern. All files whose path matches the pattern will be analyzed. The path delimiter is a forward slash.

Add

Every glob pattern specified after a dash adds all checks whose name matches the pattern. For example, ARR* means “all checks starting with ARR”, *global means "all checks ending in  global", and "*" matches all checks.

Remove (optional)

Every glob pattern specified after a dash removes all checks whose name matches the pattern. The Remove section is always processed before the Add section. For example, ARR* means “all checks starting with ARR”, *global means "all checks ending in  global", and "*" matches all checks.

Example
Settings:
  Timeout: 600
  EnableFalsePositives: true
  RunLinkAnalysis: true
  MatchAgainstProjectPaths: false
  MessageLimit: 100
  ExtraOptions: "--parallel 4 –full"
  OutputDir: Debug/C-STAT
Rules:
  - PathMatch: .*
    Add:
      - ARR*
      - *zero-check
    Remove:
      - "*"
  - PathMatch: .*Group.*
    Remove:
      - ARR*

In this example, the .* rule is first matched, then .*Group.*, where the final set of rules for a file is the superset of all rules matched to that file. The Add and Remove rules add/remove all checks that match the glob pattern: ARR* adds/removes all checks that start with ARR and *-zero-check adds all checks that end in -zero-check.

The file D:\test\main.c matches the PathMatch: .* pattern of the first rule, so—because Remove sections are processed first—all checks ("*") are removed before all checks that begin with ARR* and all checks that end in zero-check are added. The second rule is not matched, so it is not processed.

For the file D:\test\Group\file.c, both rules are matched, so the second rule removes all ARR checks added from the first rule, which leaves only checks that end in zero-check.

In other words, main.c is analyzed using the checks that begin with ARR* and end in zero-check, and file.c is analyzed using the checks that end in zero-check.

Using the configuration file with other tools

The YAML configuration file makes C-STAT easier to use together with other tools.

CMake

The C-STAT configuration file in YAML format can be used to set C-STAT options automatically when you create a new project using one of the project templates Import CMakeLists.txt or Attach to pre-configured CMake directory, see CMakeプロジェクトをIDEに追加する. When the project is created, it looks for cache variables that begin with IAR_CSTAT_CONFIG_FILE. The configuration file pointed out by IAR_CSTAT_CONFIG_FILE will be applied to all build configurations of your project, and any cache variables called IAR_CSTAT_CONFIG_FILE_buildconfig will be applied to a specific build configuration.

The Embedded Workbench editor

C-STAT can be used as a Language Server in the Embedded Workbench editor, providing continuous feedback on your code. It uses the settings from the project, either checks selected in the IDE or from a configuration file's pattern matching. See 言語サーバー(Language Servers) オプション.