Skip to content

Commit b31377d

Browse files
authored
Merge pull request #560 from knewbury01/knewbury01/fix-97
A3-3-1: missing testcases
2 parents 2786f4b + 455f39c commit b31377d

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- `A3-3-1` - `ExternalLinkageNotDeclaredInHeaderFile.ql`:
2+
- Adjust the alert message to comply with the style guide.

cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ where
3838
// Main functions are an exception to the rule
3939
not de.getDeclaration() instanceof MainFunction and
4040
if de.getDeclaration() instanceof Function then kind = "function" else kind = "object"
41-
select de, "Externally linked " + kind + " " + de.getName() + " not declared in header file."
41+
select de, "Externally linked " + kind + " '" + de.getName() + "' not declared in header file."
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
| test.cpp:3:5:3:6 | definition of g1 | Externally linked object g1 not declared in header file. |
2-
| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object g2 not declared in header file. |
3-
| test.cpp:10:5:10:6 | definition of l1 | Externally linked object l1 not declared in header file. |
4-
| test.cpp:11:6:11:7 | definition of f1 | Externally linked function f1 not declared in header file. |
5-
| test.cpp:22:5:22:5 | definition of f | Externally linked function f not declared in header file. |
6-
| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function f1 not declared in header file. |
1+
| test.cpp:3:5:3:6 | definition of g1 | Externally linked object 'g1' not declared in header file. |
2+
| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object 'g2' not declared in header file. |
3+
| test.cpp:10:5:10:6 | definition of l1 | Externally linked object 'l1' not declared in header file. |
4+
| test.cpp:11:6:11:7 | definition of f1 | Externally linked function 'f1' not declared in header file. |
5+
| test.cpp:22:5:22:5 | definition of f | Externally linked function 'f' not declared in header file. |
6+
| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function 'f1' not declared in header file. |

cpp/autosar/test/rules/A3-3-1/test.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ namespace n {
3535
void f5() { // COMPLIANT
3636
int i = 0;
3737
}
38-
} // namespace n
38+
} // namespace n
39+
40+
const int c = 1; // COMPLIANT - internal linkage
41+
const char *const str2 = "foo"; // COMPLIANT - internal linkage
42+
constexpr int k = 1; // COMPLIANT - internal linkage

0 commit comments

Comments
 (0)