misra-c2012-7.4 # A string literal shall not be assigned to an object unless the objects type is pointer to const-qualified char
misra-c2012-17.1 # The features of stdarg.h shall not be used
misra-c2012-20.1 # #include directives should only be preceded by preprocessor directives or comments
misra-c2012-21.5 # The standard header file signal.h shall not be used
misra-c2012-21.6 # The Standard Library input/output functions shall not be used
misra-c2012-21.10 # The Standard Library time and date functions shall not be used
misra-c2012-21.21 # misra violation 2121 with no text in the supplied rule-texts-file
misra-c2012-15.1 # The goto statement should not be used
misra-c2012-12.3 # The comma operator should not be used
I get the error
Failed to add suppression. Invalid id "misra-c2012-7.4 # A string literal shall not be assigned to an object unless the objects type is pointer to const-qualified char"
If I remove the ID in question, it throws the same error for the next line.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my suppressions.txt file I have the following.
unusedFunction:src/*.c
misra-c2012-7.4 # A string literal shall not be assigned to an object unless the objects type is pointer to const-qualified char
misra-c2012-17.1 # The features of stdarg.h shall not be used
misra-c2012-20.1 # #include directives should only be preceded by preprocessor directives or comments
misra-c2012-21.5 # The standard header file signal.h shall not be used
misra-c2012-21.6 # The Standard Library input/output functions shall not be used
misra-c2012-21.10 # The Standard Library time and date functions shall not be used
misra-c2012-21.21 # misra violation 2121 with no text in the supplied rule-texts-file
misra-c2012-15.1 # The goto statement should not be used
misra-c2012-12.3 # The comma operator should not be used
When I run cppcheck
cppcheck --addon=misra.json --inline-suppr -itest/ -ivendor/ -isrc/lumissil -isrc/open-plc-utils -isrc/comms/UART/evcc_llm_comms/ -Iinclude -Iinclude/CML_Integration -Iinclude/comms -Iinclude/comms/CAN -Iinclude/comms/PLC -Iinclude/comms/UART -Iinclude/M0_Integration -Iinclude/config_parsing -Iinclude/GPIO -Iinclude/utilities src/ --enable=all --suppressions-list=suppressions.txt --suppress=missingInclude . --inconclusive --xml graphal 2> cppcheck-result.xml
I get the error
Failed to add suppression. Invalid id "misra-c2012-7.4 # A string literal shall not be assigned to an object unless the objects type is pointer to const-qualified char"
If I remove the ID in question, it throws the same error for the next line.
If I run the command as
cppcheck --addon=misra.json --inline-suppr -itest/ -ivendor/ -isrc/lumissil -isrc/open-plc-utils -isrc/comms/UART/evcc_llm_comms/ -Iinclude -Iinclude/CML_Integration -Iinclude/comms -Iinclude/comms/CAN -Iinclude/comms/PLC -Iinclude/comms/UART -Iinclude/M0_Integration -Iinclude/config_parsing -Iinclude/GPIO -Iinclude/utilities src/ --enable=all --suppress=unusedFunction --suppress=misra-c2012-7.4 --suppress=misra-c2012-17.1 --suppress=misra-c2012-20.1 --suppress=misra-c2012-21.5 --suppress=misra-c2012-21.6 --suppress=misra-c2012-21.10 --suppress=misra-c2012-21.21 --suppress=misra-c2012-15.1 --suppress=misra-c2012-12.3 --inconclusive --xml graphal 2> cppcheck-result.xml
Then it works, but this is quite ugly.