Enable pointer devolution checks
Enable cpp core guidelines checks for pointer deevolution. For the
moment, simply ignore the uses, although ideally these should be cleaned
up at some point.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I9a8aae94cc7a59529eab89225a37e89628c17597
diff --git a/.clang-tidy b/.clang-tidy
index ddf3b64..85fc555 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -204,6 +204,7 @@
cppcoreguidelines-init-variables,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-macro-usage,
+cppcoreguidelines-pro-bounds-array-to-pointer-decay,
cppcoreguidelines-pro-bounds-pointer-arithmetic,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-reinterpret-cast,
diff --git a/http/logging.hpp b/http/logging.hpp
index ca6bdc6..5f268f4 100644
--- a/http/logging.hpp
+++ b/http/logging.hpp
@@ -74,6 +74,10 @@
if (level >= getCurrentLogLevel())
{
#ifdef BMCWEB_ENABLE_LOGGING
+ // Somewhere in the code we're implicitly casting an array to a
+ // pointer in logging code. It's non-trivial to find, so disable
+ // the check here for now
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
stringstream << value;
#endif
}
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 1eeb65a..0291fc9 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -353,9 +353,12 @@
bool ret = true;
if (key != keyToCheck)
{
- ret = readJsonValues<Count, Index + 1>(key, jsonValue, res, handled,
- in...) &&
- ret;
+ ret =
+ readJsonValues<Count, Index + 1>(
+ key, jsonValue, res, handled,
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
+ in...) &&
+ ret;
return ret;
}
@@ -381,6 +384,8 @@
ret = false;
messages::propertyMissing(res, key);
}
+
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
return details::handleMissing<Index + 1, Count>(handled, res, in...) && ret;
}
} // namespace details