This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

_Bool and pc_lint

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]


Parents
  • The change you applied really has to make a difference. If it didn't, the most likely reason is that the line you edited was not actually the one where bool was defined, in that run of the compiler. You'll have to watch out for other copies of <stdbool.h> lying around in the configured #include path seen by PC-lint, or other headers that believe they should be doing their own definitions. Note that PC-lint has some fall-back definitions of standard library elements of its own. This message fragment in particular

    #... ve -e921 */(_Bool) 0/*lint -restore */
    

    suggests to me that you're currently finding PC-lint's definition of "false" (from au-misra3.lnt).

Reply
  • The change you applied really has to make a difference. If it didn't, the most likely reason is that the line you edited was not actually the one where bool was defined, in that run of the compiler. You'll have to watch out for other copies of <stdbool.h> lying around in the configured #include path seen by PC-lint, or other headers that believe they should be doing their own definitions. Note that PC-lint has some fall-back definitions of standard library elements of its own. This message fragment in particular

    #... ve -e921 */(_Bool) 0/*lint -restore */
    

    suggests to me that you're currently finding PC-lint's definition of "false" (from au-misra3.lnt).

Children