aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-11-01 14:11:53 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-11-01 14:12:13 +0100
commit2631d55f61cdf5de435e35b305313a2fc9117812 (patch)
tree734c05dc8cbb221ae39264c0da042189f38dcfa9 /src
parente8f3c88133b727960a4299dd84bfe18f4ce2a676 (diff)
parent60b98f8e145617e9e50a2eb7f3181953e1e8c424 (diff)
downloadbitcoin-2631d55f61cdf5de435e35b305313a2fc9117812.tar.xz
Merge #11573: [Util] Update tinyformat.h
60b98f8 [Util] Update tinyformat.h (fanquake) Pull request description: Updates `tinyformat.h` to commit c42f/tinyformat@689695c upstream. Including: https://github.com/c42f/tinyformat/commit/8a2812d8480bfb66923eea0bb5cdda79fe4f17ba https://github.com/c42f/tinyformat/commit/5d9e05a3479d1b2ec6a4602fd797f0ec26440db2 https://github.com/c42f/tinyformat/commit/48e2e48789907f80a7aec24a3f1d69196b78ed43 @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 https://github.com/c42f/tinyformat/pull/39. The last time tinyformat.h was updated in this repo was in #8274. Tree-SHA512: a51bd30544693550e08148daf5d244e3a3a410caff7897351eb9cd28f661dc85e193e045bb86068ee4006b2f89a7233b7573b8c50d93d2a9a15a11386fdcc605
Diffstat (limited to 'src')
-rw-r--r--src/tinyformat.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tinyformat.h b/src/tinyformat.h
index 2e453e56bb..d34cfaa94f 100644
--- a/src/tinyformat.h
+++ b/src/tinyformat.h
@@ -495,7 +495,11 @@ namespace detail {
class FormatArg
{
public:
- FormatArg() {}
+ FormatArg()
+ : m_value(nullptr),
+ m_formatImpl(nullptr),
+ m_toIntImpl(nullptr)
+ { }
template<typename T>
explicit FormatArg(const T& value)
@@ -507,11 +511,15 @@ class FormatArg
void format(std::ostream& out, const char* fmtBegin,
const char* fmtEnd, int ntrunc) const
{
+ assert(m_value);
+ assert(m_formatImpl);
m_formatImpl(out, fmtBegin, fmtEnd, ntrunc, m_value);
}
int toInt() const
{
+ assert(m_value);
+ assert(m_toIntImpl);
return m_toIntImpl(m_value);
}
@@ -712,23 +720,27 @@ inline const char* streamStateFromFormat(std::ostream& out, bool& spacePadPositi
break;
case 'X':
out.setf(std::ios::uppercase);
+ // Falls through
case 'x': case 'p':
out.setf(std::ios::hex, std::ios::basefield);
intConversion = true;
break;
case 'E':
out.setf(std::ios::uppercase);
+ // Falls through
case 'e':
out.setf(std::ios::scientific, std::ios::floatfield);
out.setf(std::ios::dec, std::ios::basefield);
break;
case 'F':
out.setf(std::ios::uppercase);
+ // Falls through
case 'f':
out.setf(std::ios::fixed, std::ios::floatfield);
break;
case 'G':
out.setf(std::ios::uppercase);
+ // Falls through
case 'g':
out.setf(std::ios::dec, std::ios::basefield);
// As in boost::format, let stream decide float format.