tidy: use modernize-use-raw-string-literal #25110

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:modernize_use_raw_string_literal changing 30 files +135 −132
  1. fanquake commented at 6:29 PM on May 11, 2022: member

    Refactor and turn on modernize-raw-string-literal. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html. This is a bit noisy, but I think ultimately worth it.

    The motivation is to replace barely-(human)-parseable code like:

    HelpExampleCli("logging", "\"[\\\"all\\\"]\" \"[\\\"http\\\"]\"")
    + HelpExampleRpc("logging", "[\"all\"], [\"libevent\"]")
    

    with more-readable code like:

    HelpExampleCli("logging", R"("[\"all\"]" "[\"http\"]")")
    + HelpExampleRpc("logging", R"(["all"], ["libevent"])")
    

    while keeping the same output. i.e:

    Examples:
    Examples:
    > bitcoin-cli logging "[\"all\"]" "[\"http\"]"
    > curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "logging", "params": [["all"], ["libevent"]]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
    

    Note that we already sporadically use raw string literals in the code base.

  2. ajtowns commented at 6:37 PM on May 11, 2022: contributor

    Just my opinion, but using R"" for any cases where we'd otherwise have three backslashes in a row ("\\\"") makes sense, but where it's just escaping an individual backslash or quote, it doesn't seem that useful to me.

  3. DrahtBot added the label Refactoring on May 11, 2022
  4. DrahtBot commented at 7:17 AM on May 12, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #25276 (doc: Fix typo in importdescriptors by KolbyML)
    • #25218 (refactor: introduce generic 'Result' classes and connect them to CreateTransaction and GetNewDestination by furszy)
    • #24162 (rpc: add require_checksum flag to deriveaddresses by kallewoof)
    • #24161 (rpc/doc: describe using combo(privkey) to get checksum and then list … by kallewoof)
    • #23319 (rpc: Return fee and prevout (utxos) to getrawtransaction by dougEfresh)
    • #22838 (descriptors: Be able to specify change and receiving in a single descriptor string by achow101)

    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.

  5. DrahtBot cross-referenced this on May 12, 2022 from issue tidy: add modernize-use-default-member-init by fanquake
  6. fanquake force-pushed on May 12, 2022
  7. DrahtBot cross-referenced this on May 12, 2022 from issue [POC] build: Hello Qt 6 by hebasto
  8. DrahtBot cross-referenced this on May 12, 2022 from issue rpc: add require_checksum flag to deriveaddresses by kallewoof
  9. DrahtBot cross-referenced this on May 12, 2022 from issue rpc/doc: describe using combo(privkey) to get checksum and then list … by kallewoof
  10. DrahtBot cross-referenced this on May 13, 2022 from issue rpc: Return fee and prevout (utxos) to getrawtransaction by dougEfresh
  11. DrahtBot cross-referenced this on May 13, 2022 from issue descriptors: Be able to specify change and receiving in a single descriptor string by achow101
  12. DrahtBot added the label Needs rebase on May 18, 2022
  13. refactor: use raw string literals
    The motivation is to replace barely (human) parse-able code like:
    
    HelpExampleCli("createrawtransaction", "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"")
    
    with code like:
    
    HelpExampleCli("createrawtransaction", R"("[{\"txid\" : \"mytxid\",\"vout\":0}]" "{\"myaddress\":0.01}")")
    6d3856142b
  14. tidy: use modernize-raw-string-literal
    https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
    39c83aabca
  15. fanquake force-pushed on May 19, 2022
  16. DrahtBot removed the label Needs rebase on May 19, 2022
  17. DrahtBot cross-referenced this on May 23, 2022 from issue build: Make `--with-gui=qt6` configure option available on macOS by hebasto
  18. DrahtBot cross-referenced this on May 26, 2022 from issue refactor: introduce generic 'Result' class and connect it to CreateTransaction and GetNewDestination by furszy
  19. DrahtBot cross-referenced this on Jun 5, 2022 from issue doc: Fix typo in importdescriptors by KolbyML
  20. DrahtBot added the label Needs rebase on Jun 6, 2022
  21. DrahtBot commented at 2:07 PM on June 6, 2022: contributor

    <!--cf906140f33d8803c4a75a2196329ecb-->

    🐙 This pull request conflicts with the target branch and needs rebase.

    <sub>Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".</sub>

  22. fanquake closed this on Aug 8, 2022

  23. 8498549767 commented at 10:48 AM on January 24, 2023: none

    Exlente

  24. bitcoin locked this on Jan 24, 2023
  25. fanquake deleted the branch on Sep 14, 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: 2026-05-20 06:53 UTC