Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: Update tinyformat #8274

Merged
merged 2 commits into from Jul 29, 2016
Merged

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Jun 27, 2016

Updates tinyformat.h to commit c42f/tinyformat@3a33bbf upstream.

Makes sure that our local changes are kept:

Inspired by #8264.

Updates `tinyformat.h` to commit
c42f/tinyformat@3a33bbf upstream.

Makes sure that our local changes are kept:

- bitcoin#3767 1b8fd35 Make tinyformat errors raise an exception instead of assert()ing
- bitcoin#4735 9b6d4c5 Move strprintf define to tinyformat.h
- bitcoin#4748 6e5fd00 include stdexcept (for std::exception)
- bitcoin#8000 9eaa0af force USE_VARIADIC_TEMPLATES
- Add `std::string format(const std::string &fmt...` added this
  at the time, as we want to be able to do `strprintf(_(...), ...)`

Inspired by bitcoin#8264.
Changes in tinyformat, recently imported from upstream have made the
zero-argument versions of formatting functions unnecessary. Remove them.

This is a slight semantic change: `%` characters in the zero-argument
call are now regarded and need to be escaped. As for as I know, the only
use of this is in `main.cpp`.
@maflcko
Copy link
Member

maflcko commented Jun 29, 2016

Concept ACK a5072a7

@jonasschnelli
Copy link
Contributor

utACK a5072a7

@@ -86,6 +88,18 @@
// defined function bodies, use the macro TINYFORMAT_FOREACH_ARGNUM. For an
// example, see the implementation of printf() at the end of the source file.
//
// Sometimes it's useful to be able to pass a list of format arguments through
// to a non-template function. The FormatList class is provided as a way to do
// this by storing the argument list in a type-opaque way. Continuing the
Copy link
Contributor

Choose a reason for hiding this comment

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

Another Satoshi suspect!

Copy link
Member Author

Choose a reason for hiding this comment

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

:o we've caught the guy

@paveljanik
Copy link
Contributor

utACK a5072a7

@laanwj laanwj merged commit a5072a7 into bitcoin:master Jul 29, 2016
laanwj added a commit that referenced this pull request Jul 29, 2016
a5072a7 util: Remove zero-argument versions of LogPrint and error (Wladimir J. van der Laan)
695041e util: Update tinyformat (Wladimir J. van der Laan)
@luke-jr
Copy link
Member

luke-jr commented Sep 10, 2016

Why haven't our local changes been submitted upstream?

laanwj added a commit that referenced this pull request Nov 1, 2017
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by #10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in #8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
codablock pushed a commit to codablock/dash that referenced this pull request Jan 8, 2018
a5072a7 util: Remove zero-argument versions of LogPrint and error (Wladimir J. van der Laan)
695041e util: Update tinyformat (Wladimir J. van der Laan)
sickpig referenced this pull request in sickpig/BitcoinUnlimited Jan 11, 2018
a5072a7 util: Remove zero-argument versions of LogPrint and error (Wladimir J. van der Laan)
695041e util: Update tinyformat (Wladimir J. van der Laan)
sickpig referenced this pull request in sickpig/BitcoinUnlimited Jan 11, 2018
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by #10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in #8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
a5072a7 util: Remove zero-argument versions of LogPrint and error (Wladimir J. van der Laan)
695041e util: Update tinyformat (Wladimir J. van der Laan)
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Dec 22, 2019
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 2, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 4, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 12, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 16, 2020
60b98f8 [Util] Update tinyformat.h (fanquake)

Pull request description:

  Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including:
  c42f/tinyformat@8a2812d
  c42f/tinyformat@5d9e05a
  c42f/tinyformat@48e2e48

  @achow101 mentioned that since upgrading to Ubuntu 17.10 (GCC 7), tinyformat had been throwing lots of -Wimplicit-fallthrough warnings. However fallthrough warnings should have been silenced by bitcoin#10489. cc @theuni.

  The upstream commit to fix fallthrough warnings is in this PR c42f/tinyformat#39.

  The last time tinyformat.h was updated in this repo was in bitcoin#8274.

Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Mar 27, 2020
9fb0a43 util: Throw tinyformat::format_error on formatting error (random-zebra)
67eb699 util: Properly handle errors during log message formatting (random-zebra)
66ec97b Do not evaluate hidden LogPrint arguments (random-zebra)
2713458 util: Remove zero-argument versions of LogPrint and error (random-zebra)
500dfee util: Update tinyformat (random-zebra)
6837887 util: switch LogPrint and error to variadic templates (random-zebra)
0fa578f tinyformat: force USE_VARIADIC_TEMPLATES (random-zebra)

Pull request description:

  this backports the following pull requests from upstream bitcoin:
  - bitcoin#8000 (0fa578f, 6837887)
  > Now that we started using c++11, force use of variadic templates.
  The autodetection may be wonky on some compilers, see discussion here and is unnecessary for us anyhow.

  - bitcoin#8274 (500dfee, 2713458)
  > Updates tinyformat.h to commit c42f/tinyformat@3a33bbf upstream.

  - bitcoin#9417 (66ec97b)
  > There are a few cases where hashes are computed inside LogPrint arguments - where they usually go unused. As LogPrint statements should never have side effects besides printing something, we can avoid the evaluation in this case.
  Advantage: perhaps a small performance improvement; I haven't benchmarked.
  Disadvantage: if we would have statements with side-effects, this could make this a bit harder to debug.

  - bitcoin#9963 (67eb699, 9fb0a43)
  > Instead of having an exception propagate into the program (which at worst causes a crash) when an error happens while formatting a log message, just print a message to the log. This message clearly indicates what log message was formatted wrongly, and what error happened during formatting it.

ACKs for top commit:
  Fuzzbawls:
    ACK 9fb0a43
  furszy:
    cool, utACK 9fb0a43 .

Tree-SHA512: 29a902bb712612ca093a8fe863e9eff1c17d40955bbc37a5ceb6f057068ac6150dfcffd6836a6b0bd6295aa9bffd0925eb69e50f82ccaa7d84215efc274a59a4
akshaynexus pushed a commit to ZENZO-Ecosystem/ZENZO-Core that referenced this pull request Mar 30, 2020
9fb0a43 util: Throw tinyformat::format_error on formatting error (random-zebra)
67eb699 util: Properly handle errors during log message formatting (random-zebra)
66ec97b Do not evaluate hidden LogPrint arguments (random-zebra)
2713458 util: Remove zero-argument versions of LogPrint and error (random-zebra)
500dfee util: Update tinyformat (random-zebra)
6837887 util: switch LogPrint and error to variadic templates (random-zebra)
0fa578f tinyformat: force USE_VARIADIC_TEMPLATES (random-zebra)

Pull request description:

  this backports the following pull requests from upstream bitcoin:
  - bitcoin#8000 (0fa578f, 6837887)
  > Now that we started using c++11, force use of variadic templates.
  The autodetection may be wonky on some compilers, see discussion here and is unnecessary for us anyhow.

  - bitcoin#8274 (500dfee, 2713458)
  > Updates tinyformat.h to commit c42f/tinyformat@3a33bbf upstream.

  - bitcoin#9417 (66ec97b)
  > There are a few cases where hashes are computed inside LogPrint arguments - where they usually go unused. As LogPrint statements should never have side effects besides printing something, we can avoid the evaluation in this case.
  Advantage: perhaps a small performance improvement; I haven't benchmarked.
  Disadvantage: if we would have statements with side-effects, this could make this a bit harder to debug.

  - bitcoin#9963 (67eb699, 9fb0a43)
  > Instead of having an exception propagate into the program (which at worst causes a crash) when an error happens while formatting a log message, just print a message to the log. This message clearly indicates what log message was formatted wrongly, and what error happened during formatting it.

ACKs for top commit:
  Fuzzbawls:
    ACK 9fb0a43
  furszy:
    cool, utACK 9fb0a43 .

Tree-SHA512: 29a902bb712612ca093a8fe863e9eff1c17d40955bbc37a5ceb6f057068ac6150dfcffd6836a6b0bd6295aa9bffd0925eb69e50f82ccaa7d84215efc274a59a4
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants