diff --git a/change_notes/2024-03-19-change-alert-a3-3-1.md b/change_notes/2024-03-19-change-alert-a3-3-1.md new file mode 100644 index 0000000000..f0cceccfed --- /dev/null +++ b/change_notes/2024-03-19-change-alert-a3-3-1.md @@ -0,0 +1,2 @@ +- `A3-3-1` - `ExternalLinkageNotDeclaredInHeaderFile.ql`: + - Adjust the alert message to comply with the style guide. \ No newline at end of file diff --git a/cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql b/cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql index e7bff9ef71..06c6ad517c 100644 --- a/cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql +++ b/cpp/autosar/src/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.ql @@ -38,4 +38,4 @@ where // Main functions are an exception to the rule not de.getDeclaration() instanceof MainFunction and if de.getDeclaration() instanceof Function then kind = "function" else kind = "object" -select de, "Externally linked " + kind + " " + de.getName() + " not declared in header file." +select de, "Externally linked " + kind + " '" + de.getName() + "' not declared in header file." diff --git a/cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.expected b/cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.expected index 8ec684e14c..e5657e9eec 100644 --- a/cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.expected +++ b/cpp/autosar/test/rules/A3-3-1/ExternalLinkageNotDeclaredInHeaderFile.expected @@ -1,6 +1,6 @@ -| test.cpp:3:5:3:6 | definition of g1 | Externally linked object g1 not declared in header file. | -| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object g2 not declared in header file. | -| test.cpp:10:5:10:6 | definition of l1 | Externally linked object l1 not declared in header file. | -| test.cpp:11:6:11:7 | definition of f1 | Externally linked function f1 not declared in header file. | -| test.cpp:22:5:22:5 | definition of f | Externally linked function f not declared in header file. | -| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function f1 not declared in header file. | +| test.cpp:3:5:3:6 | definition of g1 | Externally linked object 'g1' not declared in header file. | +| test.cpp:4:12:4:13 | declaration of g2 | Externally linked object 'g2' not declared in header file. | +| test.cpp:10:5:10:6 | definition of l1 | Externally linked object 'l1' not declared in header file. | +| test.cpp:11:6:11:7 | definition of f1 | Externally linked function 'f1' not declared in header file. | +| test.cpp:22:5:22:5 | definition of f | Externally linked function 'f' not declared in header file. | +| test.cpp:25:5:25:6 | declaration of f1 | Externally linked function 'f1' not declared in header file. | diff --git a/cpp/autosar/test/rules/A3-3-1/test.cpp b/cpp/autosar/test/rules/A3-3-1/test.cpp index 194b06329c..992399f4c6 100644 --- a/cpp/autosar/test/rules/A3-3-1/test.cpp +++ b/cpp/autosar/test/rules/A3-3-1/test.cpp @@ -35,4 +35,8 @@ namespace n { void f5() { // COMPLIANT int i = 0; } -} // namespace n \ No newline at end of file +} // namespace n + +const int c = 1; // COMPLIANT - internal linkage +const char *const str2 = "foo"; // COMPLIANT - internal linkage +constexpr int k = 1; // COMPLIANT - internal linkage \ No newline at end of file