summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-01-07 20:33:43 +0300
committerEd Tanous <ed@tanous.net>2022-01-12 22:00:37 +0300
commit9b6ffca5c1cafcc5406cf835390153a370dec4f6 (patch)
tree15bf5112dea8e15a623b8d5cb0f9119f064076b4
parent600d2394cfd3a3a09b126f0570cc66561fd02d31 (diff)
downloadbmcweb-9b6ffca5c1cafcc5406cf835390153a370dec4f6.tar.xz
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
-rw-r--r--.clang-tidy1
-rw-r--r--http/logging.hpp4
-rw-r--r--redfish-core/include/utils/json_utils.hpp11
3 files changed, 13 insertions, 3 deletions
diff --git a/.clang-tidy b/.clang-tidy
index ddf3b641ab..85fc555ac5 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -204,6 +204,7 @@ clang-analyzer-webkit.RefCntblBaseVirtualDtor,
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 ca6bdc6521..5f268f4913 100644
--- a/http/logging.hpp
+++ b/http/logging.hpp
@@ -74,6 +74,10 @@ class Logger
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 1eeb65ad00..0291fc9851 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -353,9 +353,12 @@ bool readJsonValues(const std::string& key, nlohmann::json& jsonValue,
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 @@ bool handleMissing(std::bitset<Count>& handled, crow::Response& res,
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