Fixed #12267 (Misra.py: crashes in 17.7 checker when there is macro in variable declaration) (#5768)

This commit is contained in:
Daniel Marjamäki 2023-12-15 22:53:19 +01:00 committed by GitHub
parent c79ec60bee
commit 22613dc7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -3358,9 +3358,9 @@ class MisraChecker:
continue
if token.str != '(' or token.astParent:
continue
if not token.astOperand1 or not token.astOperand1.isName:
if token.astOperand1 is None or not token.astOperand1.isName:
continue
if token.astOperand1.varId and get_function_pointer_type(token.astOperand1.variable.typeStartToken) is None:
if token.astOperand1.varId and (token.astOperand1.variable is None or get_function_pointer_type(token.astOperand1.variable.typeStartToken) is None):
continue
if token.valueType is None:
continue

View File

@ -0,0 +1,12 @@
//#12267
extern uint32_t end;
//#define KEEP // if uncomment this then wont crash
KEEP static const int32_t ptr_to_end = &end;
void foo(void)
{
(void)ptr_to_end;
}