Skip to content

Commit c66a9d6

Browse files
committed
Minor comments && Update outdated .expected
1 parent 0aad1c6 commit c66a9d6

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

c/misra/src/rules/RULE-21-13/CtypeFunctionArgNotUnsignedCharOrEof.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ where
3030
/* The argument's value should be in the EOF + `unsigned char` range. */
3131
-1 <= lowerBound(ctypeCallArgument) and upperBound(ctypeCallArgument) <= 255
3232
) and
33+
/* Only report control flow that is feasible (to avoid <ctype.h> functions implemented as macro). */
3334
ctypeCall.getBasicBlock().isReachable()
3435
select ctypeCall,
3536
"The <ctype.h> function " + ctypeCall + " accepts an argument " +
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| test.c:17:7:17:17 | call to islower | The <ctype.h> function call to islower accepts an argument c3 that is not an unsigned char nor an EOF. |
2-
| test.c:23:7:23:17 | call to isdigit | The <ctype.h> function call to isdigit accepts an argument c4 that is not an unsigned char nor an EOF. |
1+
| test.c:14:7:14:13 | call to isalnum | The <ctype.h> function call to isalnum accepts an argument c3 that is not an unsigned char nor an EOF. |
2+
| test.c:20:7:20:13 | call to isalnum | The <ctype.h> function call to isalnum accepts an argument c4 that is not an unsigned char nor an EOF. |

c/misra/test/rules/RULE-21-13/test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ void sample() {
2020
isalnum(c4); // NON_COMPLIANT: is outside unsigned char range of [0, 255]
2121

2222
int c5 = getchar();
23-
int r5 = isalnum(c5); // COMPLIANT[FALSE_POSITIVE]: library functions like
24-
// getchar needs to be modelled
23+
int r5 = isalnum(
24+
c5); // COMPLIANT: <stdio.h> source functions like getchar are modelled
2525

2626
unsigned char x7;
2727
int c6;

0 commit comments

Comments
 (0)