tidy: modernize-use-nullptr #24971

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:clang_tidy_nullptr changing 12 files +29 −13
  1. fanquake commented at 11:54 am on April 25, 2022: member

    Alternative to #15112 which uses clang-tidy to do perform the checking, rather than -Wzero-as-null-pointer-constant, and avoids having to uses pragmas, i.e:

     0#if defined(HAVE_CONFIG_H)
     1#include <config/bitcoin-config.h>
     2#endif
     3
     4#if defined(HAVE_W_ZERO_AS_NULL_POINTER_CONSTANT)
     5#pragma GCC diagnostic push
     6#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
     7#pragma GCC diagnostic ignored "-Wunknown-pragmas"
     8#pragma clang diagnostic push
     9#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
    10#endif
    

    to suppress warnings coming from upstream code.

    Can be tested by dropping the preceding commit. Should produce errors like:

    0clang-tidy-14 --use-color -p=/home/ubuntu/ci_scratch/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu /home/ubuntu/ci_scratch/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/netbase.cpp
    1/home/ubuntu/ci_scratch/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/netbase.cpp:678:36: error: use nullptr [modernize-use-nullptr,-warnings-as-errors]
    2        if (!Socks5(strDest, port, 0, sock)) {
    3                                   ^
    4                                   nullptr
    
  2. in src/.bear-config:7 in 95ed7e5793 outdated
    0@@ -0,0 +1,15 @@
    1+{
    2+  "output": {
    3+    "content": {
    4+      "include_only_existing_source": true,
    5+      "paths_to_include": [],
    6+      "paths_to_exclude": [
    7+        "src/leveldb"
    


    MarcoFalke commented at 12:04 pm on April 25, 2022:
    Maybe this file should be called bear-tidy-config, as it is missing files that would otherwise be compiled in a normal (non-tidy) build?

    fanquake commented at 9:50 am on April 26, 2022:
    Have renamed to .bear-tidy-config.
  3. MarcoFalke approved
  4. DrahtBot added the label Build system on Apr 25, 2022
  5. DrahtBot added the label GUI on Apr 25, 2022
  6. DrahtBot added the label P2P on Apr 25, 2022
  7. DrahtBot added the label Wallet on Apr 25, 2022
  8. fanquake removed the label GUI on Apr 25, 2022
  9. fanquake removed the label Wallet on Apr 25, 2022
  10. fanquake removed the label Build system on Apr 25, 2022
  11. fanquake removed the label P2P on Apr 25, 2022
  12. DrahtBot added the label Build system on Apr 25, 2022
  13. DrahtBot added the label GUI on Apr 25, 2022
  14. DrahtBot added the label P2P on Apr 25, 2022
  15. DrahtBot added the label Wallet on Apr 25, 2022
  16. DrahtBot commented at 5:57 pm on April 25, 2022: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #24185 (refactor: only use explicit reinterpret/const casts, not implicit by PastaPastaPasta)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  17. Don't use zero as null pointer constant (-Wzero-as-null-pointer-constant) e53274868e
  18. tidy: enable modernize-use-nullptr 9c96f1008b
  19. fanquake force-pushed on Apr 26, 2022
  20. MarcoFalke removed the label GUI on Apr 26, 2022
  21. MarcoFalke removed the label Wallet on Apr 26, 2022
  22. MarcoFalke removed the label Build system on Apr 26, 2022
  23. MarcoFalke removed the label P2P on Apr 26, 2022
  24. MarcoFalke added the label Refactoring on Apr 26, 2022
  25. MarcoFalke approved
  26. in src/.bear-tidy-config:15 in 9c96f1008b
    10+    "format": {
    11+      "command_as_array": true,
    12+      "drop_output_field": false
    13+    }
    14+  }
    15+}
    


  27. laanwj commented at 1:05 pm on April 26, 2022: member

    Concept and code review ACK 9c96f1008b4997aea31f293fed31f98ed3becfcf

    avoids having to uses pragmas

    Much better.

  28. fanquake merged this on Apr 26, 2022
  29. fanquake closed this on Apr 26, 2022

  30. fanquake deleted the branch on Apr 26, 2022
  31. sidhujag referenced this in commit 09047541df on Apr 26, 2022
  32. PastaPastaPasta referenced this in commit 8b56495b90 on Oct 18, 2022
  33. DrahtBot locked this on Apr 26, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-05 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me