Skip to content

Commit 6b57f8d

Browse files
committed
Remove bogus case and make test.c compile
1 parent c6682eb commit 6b57f8d

File tree

1 file changed

+5
-12
lines changed
  • c/misra/test/rules/RULE-12-5

1 file changed

+5
-12
lines changed

c/misra/test/rules/RULE-12-5/test.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdint.h>
2+
#include <stdio.h>
23

34
void sample(int32_t nums[4], const char string[], int32_t x) {
45
for (int i = 0;
@@ -15,21 +16,13 @@ void sample(int32_t nums[4], const char string[], int32_t x) {
1516
printf("%c", string[i]);
1617
}
1718

18-
printf("%d\n", sizeof(x)); // COMPLIANT: `x` not a array type parameter
19+
printf("%lu\n", sizeof(x)); // COMPLIANT: `x` not a array type parameter
1920

2021
char local_string[5] = "abcd";
2122
printf(
22-
"%d\n",
23+
"%lu\n",
2324
sizeof(
2425
local_string)); // COMPLIANT: `local_string` not a function parameter
26+
}
2527

26-
const char *string = (const char *)string;
27-
28-
for (int i = 0;
29-
i < sizeof(string) / // COMPLIANT: not a parameter access anymore, now a
30-
// const char* variable declared in the body
31-
sizeof(char);
32-
i++) {
33-
printf("%c", string[i]);
34-
}
35-
}
28+
int main() { return 0; }

0 commit comments

Comments
 (0)