SinelaboreRT Header Logo

SinelaboreRT

As simple as possible, but not any simpler!

User Tools

Site Tools


wiki:howto:static_code_checkers

Static Code Checkers

Static program analysis is the analysis of computer software performed without executing any programs. Often the use of static code checkers is required in critical applications of different sort. Generally speaking the source code generated by sinelabore should create no or little issues. But some points should be considered (see below).

One of the well known tools in this category is PC-lint from Gimpel Soft (https://www.gimpel.com). Another free one is cppcheck. Generated C/C++ code is regularly tested with cppcheck and its misra checker. Details about cppcheck can be found here: https://cppcheck.sourceforge.io/manual.pdf

C-Code

For C-code the following parameter settings are suggested in the codegen.cfg file:

#It is recommended to set the following parameters to include the standard types.
#Additional include in the validate h file to provide data types
AdditionalValidateIncludes=#include <stdint.h>\n#include <stdbool.h>
#
# Include file which can be used to define the simple data types
AdditionalMachineInclude=#include <stdint.h>\n#include <stdbool.h>
#Setting the used types to avoid problems with boolean comparisons ...

UINT8 = uint8_t
UINT16 = uint16_t
BOOL=bool
BOOL_TRUE=true
BOOL_FALSE=false


#Avoid issues about not used variable
ReturnEventProcessed=yes

UseUnderlineForIncludeProtection=no

C++ Code

It is recommended to use the newer features of C++11.

#Avoid issues about not used variable
ReturnEventProcessed=yes

#Avoid issues of not initialised variables in the ctor
CallInitializeInCtor = yes

#This enables the uses of array ...
UseEnumBaseTypes = YES

EnumBaseTypeForEvents = std::uint16_t
EnumBaseTypeForStates = std::uint32_t

ReturnAndProcessEventTypeOfStateMachine = std::uint16_t
InitializedFlagTypeOfStateMachine = std::uint16_t

UseUnderlineForIncludeProtection=no
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
wiki/howto/static_code_checkers.txt · Last modified: 2022/06/09 20:06 by pmueller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki