Installing the MISRA checkers

After you install Klocwork, you can install the MISRA checkers. Klocwork provides an extensive set of checkers that support the following MISRA standards: MISRA C 2012, MISRA-C++ 2008, and MISRA-C 2004.

If you installed a previous version of MISRA checkers

When you install a new set of MISRA checkers, the package includes all of the MISRA checkers available in previous versions of Klocwork. We improve MISRA checkers in each release; therefore:
  • You may want to run a build analysis before installing the MISRA checkers to establish a baseline for citing differences in reported issues.
  • You need to uninstall the previous version before installing the new version. Even if you are installing the new package, you should uninstall the previously installed package.
  • If you previously installed the checkers by using the kwdeploy command, delete them from the <projects_root>/plugins/ directory. Then, run the kwdeploy sync command, for example, kwdeploy sync --url http://localhost:8082.
  • If you manually copied the checkers to the <server_install>/plugins directory instead of using the kwdwploy command, delete them from this directory manually.
  • After you uninstall the previous version of the MISRA checkers, verify that these checkers are no longer installed. From the Product Portal in Klocwork Static Code Analysis, open the Configuration tab for your project. The taxonomies will still be listed under the Taxonomies menu, but when you open the taxonomy, none of the MISRA-specific checkers will be listed.

Installation instructions

Installing the MISRA checker package

The MISRA checkers zip file misra.checkers.zip is located in the following Klocwork Server directory: <server_install>/taxonomies. You can also download the zip file from our support site, where the file is called misra-checkers.<build version>.zip.

The first time you install the MISRA checker package, all of the checkers are disabled by default. If you uninstall and re-install the MISRA checker package, all of the checkers you enabled previously will still be enabled.

  1. Copy the misra.checkers.zip file from the Klocwork Server taxonomies directory: <server_install>/taxonomies.
  2. Paste the zip file into the plugins directory within the projects_root directory, for example: /klocwork/server/projects_root/plugins. If the plugins directory does not exist, create it.
    Important: This is a different directory than the Klocwork Server <server_install>/plugins directory.
  3. Run the kwdeploy sync command on both the Klocwork Server and Klocwork Build Server(s), for example:
     <server_install>/bin/kwdeploy sync --url http://<Klocwork-Server-host>:<Klocwork-Server-port>
    Note: You must run this command on the host computer for the Klocwork Server, as well as every Klocwork Build Server used to run Klocwork analysis.

Installing the MISRA taxonomies

After you install the checker package, you can install the MISRA taxonomy files. There are taxonomy files for MISRA C 2004, MISRA C++ 2008, and several for MISRA C 2012, in both English and Japanese.

The taxonomy files are located in the Klocwork Server <server_install>/taxonomies directory, and have the file extension .tconf. The Japanese taxonomy files have '_ja' in the filename, for example, misra_c_2012_c99_ja.tconf.

  1. On the Klocwork Server, run the kwadmin import-config command to import a MISRA taxonomy file.
    <server_install>/bin/kwadmin import-config <project> <server_install>/taxonomies/<MISRA_taxonomy_file>
    • <MISRA_taxonomy_file> is one of the MISRA .tconf files, for example, misra_c_2004.tconf, misra_cpp_2008.tconf, misra_c_2012_c90.tconf, misra_c_2012_c99.tconf, misra_c_2012_with_amd1_c90.tconf, or misra_c_2012_with_amd1_c99.tconf.
    Tip: If you specify a project name of 'workspace', the taxonomy file will be imported into the default list of project configuration files for this projects_root directory.
  2. Repeat step one for each taxonomy that you want to import.
  3. Open the Klocwork Product Portal. Go to http://<klocwork_server_host>:<klocwork_server_port>, for example, http://localhost:8080. You can perform this step on any computer that can access the Klocwork Server.
  4. Log into Klocwork Static Code Analysis, click your project, and then click Configuration. Verify that the MISRA taxonomies are listed under the Taxonomies menu on the left. Select each taxonomy and enable any MISRA checkers that you require. Click the Image:Config editor save.png icon to save your changes.

Run a build analysis with kwbuildproject to detect violations of the MISRA standard. The checkers will be available for desktop analysis after synchronization with the Klocwork Server.

Note: In testing, Klocwork found the following checkers generate an unacceptable level of "noise", so you may not want to enable these checkers:
  • MISRA.BUILTIN_NUMERIC (MISRA-C 2004 6.3, MISRA C++ 3-9-2, MISRA C 2012 Dir 4.6)
  • MISRA.IF.NO_COMPOUND (MISRA-C 2004 14.9, MISRA C++ 6-4-1, MISRA C 2012 15.6)
  • MISRA.INCR_DECR.OTHER (MISRA-C 2004 12.13, MISRA C++ 5-2-10)
  • MISRA.PTR.ARITH (MISRA-C 2004 17.4, MISRA C++ 5-0-15)
  • MISRA.RETURN.NOT_LAST (MISRA-C 2004 14.7, MISRA C++ 6-6-5, MISRA C 2012 15.5)