misra.py: Fix R12.3 FP on calling functions in function arguments (#2778)

This commit is contained in:
Georgy Komarov 2020-09-05 08:53:56 +03:00 committed by GitHub
parent c726c34fdf
commit 4738da3d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -1674,6 +1674,9 @@ class MisraChecker:
if token.astParent.str in ('(', '{'):
end_token = token.astParent.link
if end_token:
# Don't add function called inside function arguments
if token.astParent.previous and token.astParent.previous.isName:
continue
end_tokens_map[end_token.linenr].add(end_token.column)
continue
elif token.astParent.str == ',':

View File

@ -459,6 +459,8 @@ void misra_12_3(int a, int b, int c) { // no warning
misra_12_3_fn4(misra_12_3_fn7(&a1, 32), &a1);
misra_12_3_fn6(misra_12_3_fn5(&a1, 32), &a1);
misra_12_3_fn6(misra_12_3_fn7(&a1, 32), &a1);
misra_12_3_fn7(maxlen, fn(va, unsigned long), false);
misra_12_3_fn8(maxlen, (unsigned long)((uintptr_t)fn(va, void*)), false);
const struct fun_t
{