diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2017-07-16 12:07:34 -0700 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2017-07-16 12:15:11 -0700 |
commit | 565494619d809655fa94d274bb2202d25553e485 (patch) | |
tree | 9fc0e1eb206225773d936d380040141f4d5e2375 /src/test/bswap_tests.cpp | |
parent | ad6fce67b9bb6eee864c8431ad3291aebaa2e5d2 (diff) | |
parent | 6835cb0ab26c913423cc2307c989579d05aabdcb (diff) |
Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments
6835cb0ab Avoid static analyzer warnings regarding uninitialized arguments (practicalswift)
Pull request description:
Avoid static analyzer warnings regarding _"Function call argument is a pointer to uninitialized value"_ in cases where we are intentionally using such arguments.
This is achieved by using `f(b.begin(), b.end())` (`std::array<char, N>`) instead of `f(b, b + N)` (`char b[N]`).
Rationale:
* Reduce false positives by guiding static analyzers regarding our intentions.
Before this commit:
```shell
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
EncodeBase58(b, b + 32);
^
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
key.Set(vchKey, vchKey + 32, false);
^
$
```
After this commit:
```shell
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
$
```
Tree-SHA512: 5814a320ca8b959d0954bb64393424bcad73f942d2e988de1cd6788f39153b93900325532f2e340de02d740a3953385d212ae08e7ec72bb4c394a40475f251df
Diffstat (limited to 'src/test/bswap_tests.cpp')
0 files changed, 0 insertions, 0 deletions