Fix Privileges warnings
After splitting up the compile units, warnings start showing up on the
console about privileges. This is due to them being a static global,
and not shared between the compile units.
Move the array to a constexpr structure so that all compile units see
the same init.
Change-Id: I6e035342a5b229a0601c02092ca3ce665b14bbdb
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index 8b42208..1225cdf 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -45,7 +45,7 @@
};
/** @brief A fixed array of compile time privileges */
-constexpr std::array<const char*, 5> basePrivileges{
+constexpr std::array<std::string_view, 5> basePrivileges{
"Login", "ConfigureManager", "ConfigureComponents", "ConfigureSelf",
"ConfigureUsers"};
@@ -60,7 +60,7 @@
* "hostconsole" user group. This privilege is required to access the host
* console.
*/
-static const std::array<std::string, maxPrivilegeCount> privilegeNames{
+constexpr std::array<std::string_view, maxPrivilegeCount> privilegeNames{
"Login", "ConfigureManager", "ConfigureComponents",
"ConfigureSelf", "ConfigureUsers", "OpenBMCHostConsole"};
@@ -102,7 +102,7 @@
{
if (!setSinglePrivilege(privilege))
{
- BMCWEB_LOG_CRITICAL("Unable to set privilege {}in constructor",
+ BMCWEB_LOG_CRITICAL("Unable to set privilege {} in constructor",
privilege);
}
}