Skip to content

Commit 422f170

Browse files
committed
Rule 11.1: Exclude null pointer constant
Null pointer constants can be cast to a function pointer.
1 parent 575be09 commit 422f170

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

c/misra/test/rules/RULE-11-1/ConversionBetweenFunctionPointerAndOtherType.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
| test.c:11:8:11:16 | (fp1 *)... | Cast performed between a function pointer and another type. |
22
| test.c:11:8:11:16 | (fp1)... | Cast performed between a function pointer and another type. |
33
| test.c:12:14:12:23 | (void *)... | Cast performed between a function pointer and another type. |
4-
| test.c:14:8:14:15 | (fp2)... | Cast performed between a function pointer and another type. |
54
| test.c:15:8:15:15 | (fp2)... | Cast performed between a function pointer and another type. |
65
| test.c:22:12:22:13 | (fp1)... | Cast performed between a function pointer and another type. |
76
| test.c:25:8:25:9 | (fp1)... | Cast performed between a function pointer and another type. |

c/misra/test/rules/RULE-11-1/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ void f1(void) {
1111
v1 = (fp1 *)v2; // NON_COMPLIANT
1212
void *v3 = (void *)v1; // NON_COMPLIANT
1313

14-
v2 = (fp2 *)0; // NON_COMPLIANT
14+
v2 = (fp2 *)0; // COMPLIANT - null pointer constant
1515
v2 = (fp2 *)1; // NON_COMPLIANT
1616

1717
pfp2 v4;

0 commit comments

Comments
 (0)