type-number: fix clang-tidy modernize-use-nullptr#292
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste |
|
Looks like CI fails in mptest, which may be unrelated. Also, I wonder why the CI passes fine without this change, when it does claim to run clang-tidy: libmultiprocess/ci/configs/llvm.bash Line 8 in 61de697 |
The CI does run clang-tidy, but it only warns about code that actually gets compiled. The float overload of CustomReadField (the one with = 0) is a template, so it only turns into real code when something uses a float type. libmultiprocess's own foo.capnp has no Float64 field, so that code is never generated and clang-tidy never looks at it. Bitcoin Core's .capnp does use Float64, so mpgen generates the code, and then clang-tidy can see the type and warn with modernize-use-nullptr. Adding a Float64 field on foo.capnp and foo.h would have triggered this error here. I believe there other types that are not being tested too. |
The same thing happened on #278 which only changes a markdown file. I will give a look on what's happening |
|
Added test in #294 |
Prevent warning --modernize-use-nullptr when using clang-tidy on downstream projects (Noticed when pushing 2140-dev/bitcoin#42, this change was also necessary for bitcoin/bitcoin#29409 so CI doens't error)