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
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
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