Skip to content

Commit

Permalink
Fix 10855:False positive: misra-c2012-22.10
Browse files Browse the repository at this point in the history
  • Loading branch information
swasti16 committed Oct 15, 2023
1 parent 16c5a11 commit 68ca972
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3851,6 +3851,8 @@ def misra_22_10(self, cfg):
for token in cfg.tokenlist:
if token.str == '(' and not simpleMatch(token.link, ') {'):
name, args = cppcheckdata.get_function_call_name_args(token.previous)
if not name:
continue
last_function_call = name
if token.str == '}':
last_function_call = None
Expand Down
4 changes: 4 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,4 +1929,8 @@ static void misra_22_10(void)
errno = 0;
f = strtod ( "A.12", NULL );
if ( 0 == errno ) {}

// #10855
f = strtol(numbuf, 0, (formatHex == 0U) ? 0 : 16);
if (errno != 0) {}
}

0 comments on commit 68ca972

Please sign in to comment.