Enable cppcoreguidelines-avoid-c-arrays
We only had one pretty trivial use of a C array in dbus-sensors.
Replace that with std::array, and enable the checks.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5ecbfa07a7f46977dc3ccbde3c4b385e95b6a730
diff --git a/.clang-tidy b/.clang-tidy
index 8932c14..001c11a 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -187,6 +187,7 @@
clang-analyzer-valist.ValistBase,
clang-analyzer-webkit.NoUncountedMemberChecker,
clang-analyzer-webkit.RefCntblBaseVirtualDtor,
+cppcoreguidelines-avoid-c-arrays,
cppcoreguidelines-init-variables,
misc-misplaced-const,
misc-no-recursion,
diff --git a/tests/test_Utils.cpp b/tests/test_Utils.cpp
index 6f76933..b454716 100644
--- a/tests/test_Utils.cpp
+++ b/tests/test_Utils.cpp
@@ -1,5 +1,6 @@
#include <Utils.hpp>
+#include <array>
#include <filesystem>
#include <fstream>
@@ -15,8 +16,8 @@
TestUtils()
{
// Create test environment
- char dir[] = "./testDirXXXXXX";
- testDir = mkdtemp(dir);
+ auto dir = std::to_array("./testDirXXXXXX");
+ testDir = mkdtemp(dir.data());
if (testDir.empty())
{