Skip to content

Commit

Permalink
[LINTER] Fix a couple cppcheck issues
Browse files Browse the repository at this point in the history
Summary:
This diff adds 2 cppcheck exceptions:
 - One for a bug with the current debian version (1.86):
```
   Error  (CPPCHECK) containerOutOfBounds
    Out of bounds access in expression 'test.at(1)' because 'test' is
empty
    and 'at' may be non-zero.

              48 bool sanity_test_range_fmt() {
              49     std::string test;
              50     try {
    >>>       51         test.at(1);
                ^
              52     } catch (const std::out_of_range &) {
              53         return true;
              54     } catch (...) {
```
 - One issue which is a false positive that we create deliberately for a sanity check. This one is not found by Debian's version but is by the ArchLinux version (2.3).

Test Plan:
On Debian (1.86) and Arch (2.3):
  arc lint --everything

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D8909
  • Loading branch information
Fabcien committed Jan 14, 2021
1 parent 551e9f7 commit dbf6207
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arcanist/linter/CppCheckLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ final class CppCheckLinter extends ArcanistExternalLinter {
"Class 'CCoinsViewCache' has a constructor with 1 argument that is not explicit.",
"Class 'CCoinsViewCursor' has a constructor with 1 argument that is not explicit.",
),
"src/compat/glibcxx_sanity.cpp" => array(
// This is a deliberate sanity check and not a real issue
"Out of bounds access in expression 'test.at(1)' because 'test' is empty and 'at' may be non-zero.",
),
"src/cuckoocache.h" => array(
"Struct 'KeyOnly' has a constructor with 1 argument that is not explicit.",
),
"src/init.cpp" => array(
// This is a cppcheck issue, occurring on Debian Buster's version 1.86.
// This no longer occurs with version 2.3, and maybe other earlier
// versions (untested). FIXME: remove when the bug is fixed.
"Syntax Error: AST broken, binary operator '=' doesn't have two operands.",
),
"src/net.h" => array(
"Class 'CNetMessage' has a constructor with 1 argument that is not explicit.",
),
Expand Down

0 comments on commit dbf6207

Please sign in to comment.