Quick and dirty: QAC easy project setup tips and fixes

This small guide is written as a reminder for self to save time the next time I have to use it.

As the current version used is ancient and still runs under “PRQA Framework”, this guide might be outdated soon.

Project creation

I will list what goes into each entries:

  • Project location:
    • <git_repository_root>/QAC/<project_name>
  • Project name:
    • Automatically filled in
  • Language Family:
    • C/C++
  • Project properties:
    • Analysis Configuration File:
      • <something>.acf
        • This file is telling QAC which components and versions to use (e.g., qac, qacpp, rcma, namecheck)
    • Rule Configuration File:
      • <something>.rcf
        • This file contains which rules to include for each components and how the rules are packaged into groups.
  • Unified Project:
    • As much as I would like to know, never had a QAC server to set up.
  • Filtered CTTs:
    • Lists all the supported compiler versions, select the appropriate one
      • These files are used to “spoof” the compiler functionality and tell QAC what various compiler flags mean that can come up in the source code.
  • Candidate CTT Details:
    • If a CTT from the filtered list is highlighted this window gives more information. Confirm the CTT by selecting “Use this CTT”.
  • Filter Options:
    • Bunch of filters to help navigate the dozens of CTT versions for various compilers.

Once done click create.

Project initial settings

Normally project settings automatically open after creation. The usual steps I take for setting up the project.

Project

Editing the macro for SOURCE_ROOT to point to the <git_repository_root>. To do this if the project files have been created as mentioned above:

${PROJECT_ROOT}\..\..

Sync Settings

Leave it default. The include folders and defines will be sorted out in a separate more efficient way.

Baseline

For creating new project it is best left default. I might explain how to use it later.

Analysis

There are a couple of steps to do here.

If a custom rule file has been used, it is very likely the messages database needs to change as well. Re-browse the correct message file in “User Messages File”.

Component settings (in this case qac and namecheck):

For QAC edit the following entries:
-via as text:

${PROJECT_ROOT}/settings.via

This is where all the include- and preprocessor definition flags will be added later.

For Namechek edit the following entries:

-namerulefile: Browse the .ncf file that contains the regex rules.

Rule configuration, Compiler selection, Version Control Configuration

These can be left alone.

Converting project includes and definitions into “settings.via”

TIP: Make use of the replace feature of text editors to preserve your sanity.

Navigate to QAC project root. Create a new text file “settings.via”.

In my latest case I used IAR, this is how a line of include definition was taken from the project settings:

$PROJ_DIR$/../User/inc/

IAR projects directories are usually located at:
<git_repository_root>/<Project Name>/EWARM/

We need to make this entry to point from QAC project root.
As a reminder the root is at:
<git_repository_root>/QAC/<qac_project_name>

The resulting entry should look like:

First converting IAR include to point from <git_root>
<IAR Project Name>/EWARM/../User/Inc

We can simplify it:
<IAR Project Name>/User/Inc

Then we add the bit to point from QAC project root:
../../<IAR Project Name>/User/Inc

Finally since this is supposed to look like a compiler flag so we add -I in front. It is a good practice to add quotation marks around the file path:
-I"../../<IAR Project Name>/User/Inc"


Now for the preprocessor define macros:

IAR version:
USE_FULL_LL_DRIVER
RANDOMFLAG=1

QAC version:
-D"USE_FULL_LL_DRIVER"
-D"RANDOMFLAG=1"

Save and the project should be set up.

Adding Source files

In the left “Files” tab, right click QAC and select “Add File(s)”

Select all folders and files QAC should be analysing.

These are all the settings that’s necessary for a basic QAC project setup.

Minor Fix for IAR

QAC really hates IAR’s __attribute__(<anything>) macros.
Instead of #pragma packed IAR uses __attribute__(__packed__).

Luckily this is an easy fix:
In Project Settings/Analysis/QAC for -d create a new entry

__attribute__=_ignore_paren

Apparently this is QACs way of ignoring __attribute__ entries with their bracket contents.