Skip to content

Commit cbb5423

Browse files
authored
Fix compilation issue with qcc
1 parent f8c9158 commit cbb5423

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

c/cert/test/rules/FIO38-C/test.c.qcc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <stdio.h>
2+
3+
int f1(void) {
4+
FILE my_stdout = *stdout; // NON_COMPLIANT
5+
return fputs("Hello, World!\n", &my_stdout);
6+
}
7+
8+
int f2(void) {
9+
FILE *my_stdout;
10+
my_stdout = stdout; // COMPLIANT
11+
FILE my_stdout2 = *my_stdout; // NON_COMPLIANT
12+
return fputs("Hello, World!\n", my_stdout);
13+
}
14+
int f2b(void) {
15+
FILE *const *my_stdout;
16+
my_stdout = &stdout; // COMPLIANT
17+
FILE my_stdout2 = **my_stdout; // NON_COMPLIANT
18+
return fputs("Hello, World!\n", *my_stdout);
19+
}
20+
21+
int f3(void) {
22+
FILE my_stdout;
23+
my_stdout = *stdout; // NON_COMPLIANT
24+
return fputs("Hello, World!\n", &my_stdout);
25+
}
26+
27+
int f4(void) {
28+
FILE *my_stdout;
29+
my_stdout = fopen("file.txt", "w"); // COMPLIANT
30+
return fputs("Hello, World!\n", my_stdout);
31+
}
32+
33+
int f5helper(FILE my_stdout) { return fputs("Hello, World!\n", &my_stdout); }
34+
int f5(void) {
35+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
36+
return f5helper(*my_stdout); // NON_COMPLIANT
37+
}
38+
39+
int f6helper(FILE *my_stdout) { return fputs("Hello, World!\n", my_stdout); }
40+
int f6(void) {
41+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
42+
return f6helper(my_stdout); // COMPLIANT
43+
}

0 commit comments

Comments
 (0)