Skip to content

Commit

Permalink
Merge pull request #816 from github/lcartey/a15-4-4-deviation
Browse files Browse the repository at this point in the history
A15-4-4: Support deviation on the function declaration
  • Loading branch information
lcartey authored Jan 30, 2025
2 parents 97fabeb + 7986b3b commit 83e1a8b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions change_notes/2024-12-10-a15-4-4-deviations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A15-4-4` - `MissingNoExcept.ql`:
- Enable deviations on either declarations or definitions.
2 changes: 1 addition & 1 deletion cpp/autosar/src/rules/A15-4-4/MissingNoExcept.ql
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ predicate mayCallThrowingFunctions(Function f) {

from Function f
where
not isExcluded(f, Exceptions1Package::missingNoExceptQuery()) and
not isExcluded(f.getADeclarationEntry(), Exceptions1Package::missingNoExceptQuery()) and
// No thrown exceptions
not exists(getAFunctionThrownType(f, _)) and
// But not marked noexcept(true)
Expand Down
11 changes: 11 additions & 0 deletions cpp/autosar/test/rules/A15-4-4/coding-standards.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" ?>
<codingstandards>
<!--GENERATED: DO NOT MODIFY. Changes should be made to coding-standards.yml instead.-->
<deviations>
<deviations-entry>
<rule-id>A15-4-4</rule-id>
<justification>Suppress entry.</justification>
<code-identifier>a-15-4-4-deviation</code-identifier>
</deviations-entry>
</deviations>
</codingstandards>
10 changes: 9 additions & 1 deletion cpp/autosar/test/rules/A15-4-4/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ std::string test_fp_reported_in_424(
s3.append(s1.c_str(), s1.size());
s3.append(s2.c_str(), s2.size());
return s3;
}
}

void test_no_except_deviated_decl(); // a-15-4-4-deviation

void test_no_except_deviated_decl() {}

void test_no_except_deviated_defn();

void test_no_except_deviated_defn() {} // a-15-4-4-deviation

0 comments on commit 83e1a8b

Please sign in to comment.