Questions tagged [qa-c]

For questions about configuration and usage of the static code analysis tool, QAC, as well as interpretation of messages and code metrics provided by the tool.

QAC (formerly QA-C) is a code quality assurance tool developed in 1986 for C language. Current versions additionally support C++, C# and Java. The tool provides a standalone GUI and command-line interface, and can also be integrated with Jenkins using PRQA Plugin.

QAC is distributed with pre-configured project settings for popular compilers (GCC and MS VC), as well as many compilers for embedded targets, notably Keil for ARM controllers. Generic settings are provided for unsupported compilers.

The code is checked against configurable sets of rules, notably MISRA rules (which restrict features of the C language which are deemed unsafe) and code quality metrics (like cyclomatic complexity).

References:

Related tags:

26 questions
10
votes
1 answer

Is there an implicit type promotion in "float = float - float"?

We are using QA-C for MISRA C++ conformance, but the tool spews out an error for code like this: float a = foo(); float b = bar(); float c = a - b; As far as I understand, this has no implicit type promotion as everything will happen in float-sized…
Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
4
votes
1 answer

MISRA 2012 Rule 2.2 The result of this logical operation is always 'false'

I need to check if a parameters fits in a well known list. To do so I wrote this function #define INV (0x1UL << 15U) #define NON_INV 0X00000000U #define RISING 0X00000000U #define FALLING (0x1UL << 1U) #define BOTH_EDGE ((0x1UL <<…
1
vote
1 answer

MISRA C 2012: Rule-2.4

This rule states that a project should not contain unused tag declarations. Example: typedef struct record_s /* Non-compliant */ { unsigned short ax; unsigned short bx; } record1_t; typedef struct /* Compliant */ …
DJellybean
  • 33
  • 3
1
vote
1 answer

QAC Warning regarding destructor

I have a class defined like somewhat below where copy constructor and assignment operator are deleted. QAC is throwing a warning that "This class has declared default or deleted special members but no destructor". Why is the warning and how to I…
Salvankar
  • 91
  • 6
1
vote
2 answers

What is the wrong in the following c code ? MISRA quality warning message

I am getting MISRA QAC warning for the following code sample snippet. That is 'Value of control expression is not derived from an explicit logical operation.' It is clear that without assigning the return value to a variable evaluation has been…
Photon001
  • 145
  • 9
1
vote
1 answer

C programming: How to get rid of the QAC warning when pass 2D array as a const function argument?

I want to pass a 2D array to a function, and the value of the array will not be modified in that function. So I am thinking about doing this way: #include static INT8 TwoDimArrayConst(const INT8 ai_Array[2][2]); int main(void) { …
fuhuan26
  • 43
  • 5
1
vote
1 answer

Array type is used as a reference type argument in the function call

I am using PRQA QA C++ as source code analyzer. This is the first code I analyzed : void test1(int * var); void example1() { int var1[10]; test1(var1); } QA C++ told me Array type is used as a pointer type…
C. MICHEL
  • 13
  • 2
1
vote
1 answer

How to run QAC tool from command line?

I have a C project and I would like to run QAC tool v7.0 from command line. I tried the following option, C:\qac.exe -via However, when I run the above command. I get an error saying the "VersionTag" is not found. The…
Deepak V
  • 299
  • 2
  • 15
1
vote
2 answers

PRQA: How to ignore some specific files?

I have a framework, which generates 7000 PRQA warnings. 5000 warnings are created by automatically created files. I want to remove those files from the analysis. How to do this? I tried: qacli.exe pprops -P C:\my_project --sync-setting…
Bart Mensfort
  • 995
  • 11
  • 21
1
vote
6 answers

How to avoid "Bitwise operations on signed data will give implementation defined results" in QAC?

I am getting Msg(3:4130) Bitwise operations on signed data will give implementation defined results this warning in QAC. The code like functionName( a | b | c); QAC on PIC micro controller code. Anyone can explain. what is this warning and how…
user4689277
1
vote
1 answer

QA-C does not give a warning on multiple return statements in one project but does in the other?

At my work place we have just started a new project, and this project also requires MISRA-C checks. And we are using QA-C to perform these. Our first project is using m2cm message personality, nothing altered. One of them messages that is turned on…
Daan Timmer
  • 14,771
  • 6
  • 34
  • 66
0
votes
1 answer

MISRA C 2012: Rule-10.5

QA-C Rule 4303 states that An expression of ’essentially Boolean’ type is being cast to signed type. I want to understand what could be actual problem if we typecast essentially boolean to signed type with example? In C90 as there is no boolean data…
DJellybean
  • 33
  • 3
0
votes
1 answer

Helix QAC++ project creation by cli

it is possible to create a project Helix QAC++ by qacli? now, i create an empty project by QAC++ GUI and then i use qacli sync in order to syncronize and populate the project with all the cpp file. is there an alternative way to do this?
angelo
  • 25
  • 4
0
votes
1 answer

This assignment is redundant. The value of this object is never used before being modified | MISRA_2012 QAC, Message Identifier 2982

I am getting below MISRA QAC Warning. This assignment is redundant. The value of this object is never used before being modified. MISRA_2012, QAC, Message Identifier: 2982 I am trying to modify local status of variable to specific error…
kapilddit
  • 1,729
  • 4
  • 26
  • 51
0
votes
1 answer

Number of macro definitions exceeds 4095 - program does not conform strictly to ISO:C99

I am observing below MISRA Warnings. [L] Number of macro definitions exceeds 4095 - program does not conform strictly to ISO:C99. MISRA - 2012, Message Identifier : 0380 Code line: #include "COMH_ExteriorLightUI.h" Do we have any limit on number of…
kapilddit
  • 1,729
  • 4
  • 26
  • 51
1
2