Skip to content

Commit 32fd091

Browse files
committed
RULE-8-7: Add appropriate definitions to test
Ensure definitions occur in one translation unit only.
1 parent 70c776a commit 32fd091

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.c:2:5:2:6 | i2 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:8:3:8:4 | i2 | i2 |
2-
| test.h:2:12:2:13 | i1 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:7:3:7:4 | i1 | i1 |
3-
| test.h:4:13:4:14 | f2 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:10:3:10:4 | call to f2 | call to f2 |
1+
| test.c:3:5:3:6 | i1 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:10:3:10:4 | i1 | i1 |
2+
| test.c:4:5:4:6 | i2 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:11:3:11:4 | i2 | i2 |
3+
| test.c:6:6:6:7 | f2 | Declaration with external linkage is accessed in only one translation unit $@. | test.c:13:3:13:4 | call to f2 | call to f2 |

c/misra/test/rules/RULE-8-7/test.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#include "test.h"
2-
int i2; // NON_COMPLIANT - accessed one translation unit
3-
static void f3(); // COMPLIANT - internal linkage
4-
extern void f3(); // COMPLIANT - internal linkage
2+
int i = 0;
3+
int i1 = 0;
4+
int i2; // NON_COMPLIANT - accessed one translation unit
5+
void f1() {} // Definition
6+
void f2() {} // Definition
7+
static void f3() {}; // COMPLIANT - internal linkage
58
void f() {
69
i = 0;
710
i1 = 0;

0 commit comments

Comments
 (0)