Some work on moving towards to the new cppcheck MISRA scanner

This commit is contained in:
Josh Stewart 2019-01-23 12:05:14 +13:00
parent 85d2243c6e
commit 90de9d06f8
5 changed files with 45 additions and 10 deletions

26
misra/check_misra_v1.86.sh Executable file
View File

@ -0,0 +1,26 @@
if [ -f ./results.txt ]; then
rm results.txt
fi
cd speeduino/speeduino
#cppcheck --dump --inline-suppr --suppress=syntaxError:src/PID_v1/PID_v1.h --suppressions-list=../misra/suppressions.txt --include=./*.h -DCORE_AVR=1 -D__AVR_ATmega2560__ -U__STM32F1__ -USTM32F4 ./*.ino > /dev/null
cppcheck --dump --inline-suppr --suppress=syntaxError:src/PID_v1/PID_v1.h --suppressions-list=../misra/suppressions.txt --include=./*.h -DCORE_AVR=1 -D__AVR_ATmega2560__ -U__STM32F1__ -USTM32F4 -UCORE_STM32 -UCORE_TEENSY ./storage.ino > /dev/null
cd ../..
mv speeduino/speeduino/*.dump ./
rm ./utils.*.dump
python cppcheck/addons/misra.py --rule-texts=speeduino/misra/misra_2012_text.txt *.dump 2> results.txt
#python cppcheck/addons/misra.py --rule-texts=speeduino/misra/misra_2012_text.txt board_avr2560.ino.dump 2> results.txt
#rm *.dump
cat results.txt
# wc -l results.txt
errors=`wc -l < results.txt | tr -d ' '`
echo $errors MISRA violations
if [ $errors -gt 0 ]; then
exit 1
else
exit 0
fi

View File

@ -34,7 +34,7 @@ No text specified
Rule 5.3
Mandatory - An identifier (variable) in an outer scope shall not be redfined within an inner scope
Rule 5.4
No text specified
Mandatory - Macro names must be unique
Rule 5.5
No text specified
Rule 5.6
@ -116,9 +116,9 @@ No text specified
Rule 11.3
No text specified
Rule 11.4
No text specified
Advisory - Object pointers should not be treated as or converted to integers
Rule 11.5
No text specified
Advisory - A void pointer should not be converted to an object pointer
Rule 11.6
No text specified
Rule 11.7

7
misra/suppressions.txt Normal file
View File

@ -0,0 +1,7 @@
misra_12.1:board_avr2560.ino:7
misra_14_4
misra.5.2
MISRA_16_4:misra-suppressions1-test.c
MISRA.16.6:misra-suppressions1-test.c
MISRA_4_1:misra-suppressions2-test.c
MISRA.19_2:misra-suppressions2-test.c

View File

@ -43,12 +43,12 @@ const char pageTitles[] PROGMEM //This is being stored in the avr flash instead
};
void command();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable.
void sendValues(uint16_t offset, uint16_t packetlength,byte cmd, byte portnum);
void receiveValue(int offset, byte newValue);
void sendValues(uint16_t, uint16_t,byte, byte);
void receiveValue(int, byte);
void saveConfig();
void sendPage(bool useChar);
void receiveCalibration(byte tableID);
void sendToothLog(bool useChar);
void sendPage(bool);
void receiveCalibration(byte);
void sendToothLog(bool);
void testComm();
void commandButtons();

View File

@ -31,7 +31,8 @@ struct table2D {
byte cacheTime; //TRacks when the last cache value was set so it can expire after x seconds. A timeout is required to pickup when a tuning value is changed, otherwise the old cached value will continue to be returned as the X value isn't changing.
};
void table2D_setSize(struct table2D targetTable, byte newSize);
//void table2D_setSize(struct table2D targetTable, byte newSize);
void table2D_setSize(struct table2D, byte);
struct table3D {
@ -49,7 +50,8 @@ struct table3D {
byte lastYMax, lastYMin;
};
void table3D_setSize(struct table3D *targetTable, byte newSize);
//void table3D_setSize(struct table3D *targetTable, byte);
void table3D_setSize(table3D, byte);
/*
3D Tables have an origin (0,0) in the top left hand corner. Vertical axis is expressed first.