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