Include tinyformat as a subtree #13845

pull Empact wants to merge 3 commits into bitcoin:master from Empact:tinyformat-subtree changing 24 files +2342 −1058
  1. Empact commented at 4:03 AM on August 2, 2018: member

    This adds the existing c42f/tinyformat@689695c of tinyformat as a subtree, and extracts the modifications that had been made to a utilstrprintf.h wrapper file which is included instead of tinyformat.h directly.

    The benefits being that this should be easier to verifiably update and clearer what changes are being introduced, while making it easier to identify tinyformat.h as a dependency rather than a project file, and apply special treatment relative to that fact.

    This re-opens #13842

  2. fanquake added the label Upstream on Aug 2, 2018
  3. DrahtBot commented at 5:27 AM on August 2, 2018: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->No more conflicts as of last run.

  4. Empact cross-referenced this on Aug 2, 2018 from issue Move src/tinyformat.h to src/tinyformat/tinyformat.h by Empact
  5. DrahtBot cross-referenced this on Aug 2, 2018 from issue Inline i64tostr and itostr by Empact
  6. DrahtBot cross-referenced this on Aug 2, 2018 from issue travis: WIP - build and run tests on os: osx by scravy
  7. DrahtBot cross-referenced this on Aug 2, 2018 from issue Test for Windows encoding issue by ken2812221
  8. DrahtBot cross-referenced this on Aug 2, 2018 from issue PSBT key path cleanups by sipa
  9. DrahtBot cross-referenced this on Aug 2, 2018 from issue Remove the boost/algorithm/string/case_conv.hpp dependency by l2a5b1
  10. DrahtBot cross-referenced this on Aug 2, 2018 from issue [refactor] Fix the chainparamsbase -> util circular dependency by Empact
  11. DrahtBot cross-referenced this on Aug 2, 2018 from issue policy: Report reason inputs are nonstandard from AreInputsStandard by Empact
  12. DrahtBot cross-referenced this on Aug 2, 2018 from issue [bugfix] Fix encoding issue for Windows by ken2812221
  13. DrahtBot cross-referenced this on Aug 2, 2018 from issue util: Make strprintf noexcept. Improve error message on format string error. by practicalswift
  14. laanwj commented at 8:11 AM on August 2, 2018: member

    Concept ACK I didn't do this initially because I didn't expect tinyformat to be an actually maintained library (as well as not really understanding submodules very well at the time), but in retrospect this is better.

  15. scravy commented at 9:03 AM on August 2, 2018: contributor

    utACK – LGTM

  16. laanwj added this to the milestone 0.18.0 on Aug 2, 2018
  17. laanwj commented at 2:08 PM on August 2, 2018: member

    labeling this for after the 0.18 branch-off, I don't think this makes sense to do last-minute for 0.17

  18. Empact commented at 2:20 PM on August 2, 2018: member

    @laanwj Agreed

  19. Empact commented at 5:51 PM on August 2, 2018: member

    Repeating @MarcoFalke's concern here for visibility:

    Seems like a lot of files to pull in just to make it a subtree, no? Imo tinyformat is really meant to be a single file just to be copied into the project." #13842 (comment)

    I have a mild preference for automatic checks of consistency with upstream, but #13846 exists as an alternative.

  20. Empact force-pushed on Aug 2, 2018
  21. DrahtBot cross-referenced this on Aug 3, 2018 from issue util: Add [[nodiscard]] to all {Decode,Parse}[...](...) functions returning bool by practicalswift
  22. DrahtBot cross-referenced this on Aug 3, 2018 from issue travis: move script sections to files in `.travis/` subject to shellcheck by scravy
  23. DrahtBot cross-referenced this on Aug 3, 2018 from issue utils: Use _wfopen and _wfreopen on Windows by ken2812221
  24. DrahtBot cross-referenced this on Aug 3, 2018 from issue utils: drop boost::interprocess::file_lock by ken2812221
  25. in src/Makefile.am:24 in f5ee845d42 outdated
      20 | @@ -21,7 +21,7 @@ endif
      21 |  
      22 |  BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)
      23 |  
      24 | -BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
      25 | +BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include -I$(srcdir)/tinyformat
    


    ajtowns commented at 6:55 AM on August 7, 2018:

    tinyformat.h is only included directly from utilstrprintf.h; seems more sensible to just have utilstrprint.h #include <tinyformat/tinyformat.h> and not extend the include path?

  26. ajtowns commented at 7:07 AM on August 7, 2018: contributor

    Concept ACK

  27. laanwj commented at 12:49 PM on August 7, 2018: member

    Seems like a lot of files to pull in just to make it a subtree, no? Imo tinyformat is really meant to be a single file just to be copied into the project."

    After seeing the number of files added here I think I'm starting to agree with @MarcoFalke.

    Meta-nit: In general it's a bad idea to open multiple competing PRs, because it distributes the discussion over multiple places, which leads to confusion.

  28. Empact commented at 4:09 PM on August 7, 2018: member

    Here are the files included in the subtree - 10 in total: https://github.com/Empact/bitcoin/tree/tinyformat-subtree/src/tinyformat

    #13846 cuts this to ~2~ 1: https://github.com/Empact/bitcoin/tree/tinyformat-subdir/src/tinyformat

    The other changed files relate mostly to redirecting tinyformat.h includes to utilstrprintf.h.

  29. Empact force-pushed on Aug 7, 2018
  30. ajtowns commented at 4:54 AM on August 8, 2018: contributor

    The two PRs is a bit of a pain. I think I have a mild preference for the 10-files-but-automatic-checks over 2-files-but-manual-checks, but am not really bothered either way.

    The 46-files-changed is mostly just churn to pull out the customisations into utilstrprintf.h. You could avoid that by renaming utilstrprintf.h back to tinyformat.h (which then includes tinyformat/tinyformat.h). If I'm counting right, doing that gets it down to 24 changes: 10 src/tinyformat/, src/tinyformat.h, dev-notes.md, copyright_header.py, Makefile.am, src/Makefile.am, 6 lint files, travis.yml, and src/primitives/block.{h,cpp}. The block.{h,cpp} changes are just to directly include some standard headers so could also be skipped.

  31. in src/Makefile.am:185 in 7823f5cff3 outdated
     181 | @@ -182,6 +182,7 @@ BITCOIN_CORE_H = \
     182 |    util.h \
     183 |    utilmemory.h \
     184 |    utilmoneystr.h \
     185 | +  utilstrprintf.h \
    


    ajtowns commented at 4:54 AM on August 8, 2018:

    Is this change needed/useful?

  32. Empact commented at 5:17 AM on August 8, 2018: member

    One option is to split this into 2 prs: the extraction of utilstrprintf.h and the move to a subdir (which would be pretty trivial at that point).

  33. Empact cross-referenced this on Aug 10, 2018 from issue build: Enable -Wdocumentation (clang) if available by practicalswift
  34. DrahtBot cross-referenced this on Aug 11, 2018 from issue refactor: Removal of circular dependency between index/txindex, validation and index/base by mgrychow
  35. ken2812221 commented at 11:48 AM on August 12, 2018: contributor

    Agree with @ajtowns, rename utilstrprintf.h to tinyformat.h

  36. Empact force-pushed on Aug 12, 2018
  37. Empact force-pushed on Aug 12, 2018
  38. DrahtBot cross-referenced this on Aug 14, 2018 from issue ~~Correctly~~ terminate HTTP server by promag
  39. DrahtBot added the label Needs rebase on Aug 27, 2018
  40. Squashed 'src/tinyformat/' content from commit 689695cf5
    git-subtree-dir: src/tinyformat
    git-subtree-split: 689695cf58700e6defe3741829564cd682d5ae57
    ddbf92320a
  41. Merge commit 'ddbf92320a97efa36994f42144960094e3bd10e6' as 'src/tinyformat' 7605cd180b
  42. Drop src/tinyformat.h in favor of the subtree src/tinyformat/
    Introduce modifications to tinyformat via src/tinyformat.h
    
    This includes changes in:
    695041e4952ea40e0 - util: Update tinyformat
    1b8fd35aadfad6a1e - Make tinyformat errors raise an exception instead of assert()ing
    9b6d4c5cdc1ad7b12 - Move strprintf define to tinyformat.h
    6e5fd003e04b81115 - Move `*Version()` functions to version.h/cpp
    9eaa0afa6ec5d3dd0 - tinyformat: force USE_VARIADIC_TEMPLATES
    b651270cd6bfdd6d7 - util: Throw tinyformat::format_error on formatting error
    
    This does not include changes below, and it protects against future unintended
    modification of upstream code via git-subtree-check:
    64fb0ac016c7fd01c - Declare single-argument (non-converting) constructors "explicit"
    4d9b4256d89d1f7c6 - Fix typos
    
    Note I excluded only the tinyformat cpp from the boost lint checks out of an
    abundance of caution - these files are not actually built into bitcoin so are
    not at risk of pulling in unwanted dependencies, whereas the header, and other
    dependencies might be.
    8bb7c2519a
  43. Empact force-pushed on Aug 28, 2018
  44. Empact commented at 1:25 AM on August 28, 2018: member

    Rebased for #13863 (actually, regenerated subtree and cherry-picked changes)

  45. DrahtBot removed the label Needs rebase on Aug 28, 2018
  46. laanwj commented at 1:37 PM on August 31, 2018: member

    Closing (see #13846 (comment))

  47. laanwj closed this on Aug 31, 2018

  48. bitcoin locked this on Sep 8, 2021

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:55 UTC