Skip to content

Conversation

Empact
Copy link
Contributor

@Empact Empact commented Aug 2, 2018

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

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 2, 2018

No more conflicts as of last run.

@laanwj
Copy link
Member

laanwj commented Aug 2, 2018

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.

@scravy
Copy link
Contributor

scravy commented Aug 2, 2018

utACK – LGTM

@laanwj laanwj added this to the 0.18.0 milestone Aug 2, 2018
@laanwj
Copy link
Member

laanwj commented Aug 2, 2018

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

@Empact
Copy link
Contributor Author

Empact commented Aug 2, 2018

@laanwj Agreed

@Empact
Copy link
Contributor Author

Empact commented Aug 2, 2018

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.

Copy link
Contributor

@ajtowns ajtowns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

src/Makefile.am Outdated
@@ -21,7 +21,7 @@ endif

BITCOIN_INCLUDES=-I$(builddir) $(BDB_CPPFLAGS) $(BOOST_CPPFLAGS) $(LEVELDB_CPPFLAGS) $(CRYPTO_CFLAGS) $(SSL_CFLAGS)

BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include
BITCOIN_INCLUDES += -I$(srcdir)/secp256k1/include -I$(srcdir)/tinyformat
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@laanwj
Copy link
Member

laanwj commented Aug 7, 2018

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.

@Empact
Copy link
Contributor Author

Empact commented Aug 7, 2018

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.

@Empact Empact force-pushed the tinyformat-subtree branch from f5ee845 to 7823f5c Compare August 7, 2018 16:11
@ajtowns
Copy link
Contributor

ajtowns commented Aug 8, 2018

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.

src/Makefile.am Outdated
@@ -182,6 +182,7 @@ BITCOIN_CORE_H = \
util.h \
utilmemory.h \
utilmoneystr.h \
utilstrprintf.h \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed/useful?

@Empact
Copy link
Contributor Author

Empact commented Aug 8, 2018

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).

@ken2812221
Copy link
Contributor

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

@Empact Empact force-pushed the tinyformat-subtree branch 2 times, most recently from 3ae0361 to 5e84670 Compare August 12, 2018 19:24
Empact added 3 commits August 27, 2018 18:17
git-subtree-dir: src/tinyformat
git-subtree-split: 689695cf58700e6defe3741829564cd682d5ae57
Introduce modifications to tinyformat via src/tinyformat.h

This includes changes in:
695041e - util: Update tinyformat
1b8fd35 - Make tinyformat errors raise an exception instead of assert()ing
9b6d4c5 - Move strprintf define to tinyformat.h
6e5fd00 - Move `*Version()` functions to version.h/cpp
9eaa0af - tinyformat: force USE_VARIADIC_TEMPLATES
b651270 - 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:
64fb0ac - Declare single-argument (non-converting) constructors "explicit"
4d9b425 - 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.
@Empact Empact force-pushed the tinyformat-subtree branch from 5e84670 to 8bb7c25 Compare August 28, 2018 01:21
@Empact
Copy link
Contributor Author

Empact commented Aug 28, 2018

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

@laanwj
Copy link
Member

laanwj commented Aug 31, 2018

Closing (see #13846 (comment))

@laanwj laanwj closed this Aug 31, 2018
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants