trying to use pc-lint with MISRA 2012 I have tried to change in stdbool
#define bool _Bool //typedef _Bool bool;
makes no difference
any suggestions?
I get the below type of 'report' all over the place.
bool bIsFahrenheit = false; ^ ..\Src\statemachine.c(34,0): Note 970: Use of modifier or type '_Bool' outside of a typedef [MISRA 2012 Directive 4.6, advisory] ^ ..\Src\statemachine.c(34,0): Note 9075: external symbol 'bIsFahrenheit' defined without a prior declaration [MISRA 2012 Rule 8.4, required] #... ve -e921 */(_Bool) 0/*lint -restore */ ^ ..\Src\statemachine.c(34,0): Note 970: Use of modifier or type '_Bool' outside of a typedef [MISRA 2012 Directive 4.6, advisory]
You'll have to watch out for other copies of <stdbool.h> lying around in the configured #include path seen by PC-lint,
there are no stdbool in the project directory these are the ones in the keil directory
C:\keil_v5\ARM\ARMCC\include C:\keil_v5\ARM\ARMCLANG\include C:\keil_v5\ARM\ARMCLANG\include\libcxx C:\keil_v5\ARM\ARMCLANG\lib\clang\5.0.0\include
this is the includes in the project options ../Inc;../Drivers/STM32F0xx_HAL_Driver/Inc;../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32F0xx/Include;../Drivers/CMSIS/Include;../Touch-user;../Middleware-touch/inc;../Lcd;..\Images
it seems the Keil directory links are automsatic 2) if yes, how do I modify w/o getting compile errors
computer control string from project options: --c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O0 --apcs=interwork --split_sections -I ../Inc -I ../Drivers/STM32F0xx_HAL_Driver/Inc -I ../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F0xx/Include -I ../Drivers/CMSIS/Include -I ../Touch-user -I ../Middleware-touch/inc -I ../Lcd -I ../Images -I./RTE/_GP_TMO -IC:/Keil_v5/ARM/PACK/ARM/CMSIS/5.0.1/CMSIS/Include -IC:/Keil_v5/ARM/PACK/Keil/STM32F0xx_DFP/1.5.0/Device/Include -D__UVISION_VERSION="524" -D_RTE_ -DSTM32F091xC -DUSE_HAL_DRIVER -DSTM32F091xC -DTMO -o .\Obj\*.o --omf_browse .\Obj\*.crf --depend .\Obj\*.d
erik
it seems the Keil directory links are automsatic
For the Keil compiler itself: evidently. For PC-Lint: not so much. Unless the IDE adds its own -i"$(KEILDIR)/ARM..." flags to the PC-lint call automatically, you'll have to do that yourself, in the configuration of the lint integration.
typedef unsigned int uint32_t; (stdint) no lint problem typedef _Bool bool; (stdbool modified) lint problem.
the lint issue must be in a difference of what is assigned by the compiler
Hello Erik,
I looked in the "MISRA C:2012 Technical Corrigendum 1 Technical clarification of MISRA C:2012 June 2017" guide at:
www.misra.org.uk/LinkClick.aspx
On Page 7, regarding Directive 4.6, they are using examples of not using plain char instead of signed or unsigned char.
So if you want to it may be OK to use +e970 -esym(970,bool) in your code to have Lint ignore booleans.
... but I am not a language lawyer, so I say ask on: Ask on https://www.misra.org.uk/forum to be safe
Or on Gimpbel's forum. Not quite the same issue you had, but here was a customer using the C++ MISRA standard, and running into issues with C types and MISRA warnings:
www.gimpel.com/Discussion.cfm
oops instead of "in your code" I should have said use
+e970 -esym(970,bool)
in your copy of the MISRA-2012 lint configuration file MISRA_C_2012_Config.lnt