I'm receving the follwing execption using MISRA checker in d4d9bb4830a9198c161e82ef81dd1d0d6c6cef92
I've not yet dug into what source code is generating the exception.
Traceback (most recent call last):
File "/usr/bin/misra.py", line 2497, in <module>
main()
File "/usr/bin/misra.py", line 2440, in main
checker.parseDump(item)
File "/usr/bin/misra.py", line 2280, in parseDump
self.misra_8_12(cfg)
File "/usr/bin/misra.py", line 930, in misra_8_12
if not e_token.previous.str in ',{':
TypeError: 'in <string>' requires string as left operand, not instance</string></module>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, we could add a sanitiy check to verify that e_token.previous.str really is a string, but i think it would be better to know what caused e_token.previous.str to be no string.
Is the code compilable? Maybe there is some compiler specific code at that place?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is valid compilable code, but it causes misra.py to throw an exception:
File "../misra.py", line 2286, in parseDump
self.misra_8_12(cfg)
File "../misra.py", line 903, in misra_8_12
if not e_token.previous.str in ',{':
TypeError: 'in <string>' requires string as left operand, not instance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I created a ticket: https://trac.cppcheck.net/ticket/9208
If you find another maybe similar problematic code we can add it there or create another ticket.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm receving the follwing execption using MISRA checker in d4d9bb4830a9198c161e82ef81dd1d0d6c6cef92
I've not yet dug into what source code is generating the exception.
Traceback (most recent call last):
File "/usr/bin/misra.py", line 2497, in <module>
main()
File "/usr/bin/misra.py", line 2440, in main
checker.parseDump(item)
File "/usr/bin/misra.py", line 2280, in parseDump
self.misra_8_12(cfg)
File "/usr/bin/misra.py", line 930, in misra_8_12
if not e_token.previous.str in ',{':
TypeError: 'in <string>' requires string as left operand, not instance</string></module>
Hmm, we could add a sanitiy check to verify that
e_token.previous.str
really is a string, but i think it would be better to know what causede_token.previous.str
to be no string.Is the code compilable? Maybe there is some compiler specific code at that place?
I have found code that causes such an exception:
This is valid compilable code, but it causes misra.py to throw an exception:
I created a ticket: https://trac.cppcheck.net/ticket/9208
If you find another maybe similar problematic code we can add it there or create another ticket.
Yes the code compiles.
It seems to associated with code that uses this macro.
I know the (0u >>) looks odd but its part of a general form of computing interrupt prioritys. The 0u could be 1,2,3,... etc.
If I do a print(e_token.str) when checking the .c file containg this code then GPIO_WAKE_IRQ_PRIORITY is printed before the exception occurs.
Looks like this got fixed in master. Thank you. Now I can make more progress on moving to newer cppcheck.