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
diff --git a/.clang-tidy b/.clang-tidy
index 93db922..b708a70 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -210,6 +210,7 @@
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 4969d27..8e3cce5 100644
--- a/include/json_html_serializer.hpp
+++ b/include/json_html_serializer.hpp
@@ -161,14 +161,16 @@
{
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 @@
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);