diff options
author | Ed Tanous <edtanous@google.com> | 2022-01-07 20:39:33 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-01-12 22:00:37 +0300 |
commit | 49d1eeaab4085cd0284ee041f4775aaa982074c6 (patch) | |
tree | 371a4a015aa5514068bd4b47bb6afe9ce01de0b5 | |
parent | 4bac4a89b2739caf9bb250327757c44dd5f35c16 (diff) | |
download | bmcweb-49d1eeaab4085cd0284ee041f4775aaa982074c6.tar.xz |
enable cppcoreguidelines-pro-type-vararg checks
We only use varargs in some code we borrowed from nlohmann, so ignore
that, and enable the check.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iab1305784e7532e2ee10c617fb59b75aba142ce6
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | include/json_html_serializer.hpp | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/.clang-tidy b/.clang-tidy index 93db92207d..b708a70881 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -210,6 +210,7 @@ cppcoreguidelines-pro-type-const-cast, cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-type-member-init, cppcoreguidelines-pro-type-reinterpret-cast, +cppcoreguidelines-pro-type-vararg, cppcoreguidelines-special-member-functions, misc-misplaced-const, #misc-no-recursion, diff --git a/include/json_html_serializer.hpp b/include/json_html_serializer.hpp index 4969d27278..8e3cce5da0 100644 --- a/include/json_html_serializer.hpp +++ b/include/json_html_serializer.hpp @@ -161,14 +161,16 @@ inline void dumpEscaped(std::string& out, const std::string& str) { if (codePoint <= 0xFFFF) { - (std::snprintf)( - stringBuffer.data() + bytes, 7, "\\u%04x", - static_cast<uint16_t>(codePoint)); + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + std::snprintf(stringBuffer.data() + bytes, 7, + "\\u%04x", + static_cast<uint16_t>(codePoint)); bytes += 6; } else { - (std::snprintf)( + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + std::snprintf( stringBuffer.data() + bytes, 13, "\\u%04x\\u%04x", static_cast<uint16_t>(0xD7C0 + @@ -400,6 +402,7 @@ inline void dumpfloat(std::string& out, double number, static constexpr auto d = std::numeric_limits<double>::max_digits10; // the actual conversion + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) std::ptrdiff_t len = std::snprintf(numberbuffer.data(), numberbuffer.size(), "%.*g", d, number); |