sysfs: Fix several clang-tidy issues
* cppcoreguidelines-avoid-c-arrays
* cppcoreguidelines-pro-bounds-array-to-pointer-decay
* readability-identifier-naming
```
../sysfs.hpp:45:28: error: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,-warnings-as-errors]
static constexpr const char BRIGHTNESS[] = "brightness";
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:45:33: error: invalid case style for variable 'BRIGHTNESS' [readability-identifier-naming,-warnings-as-errors]
static constexpr const char BRIGHTNESS[] = "brightness";
^~~~~~~~~~
brightness
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:46:28: error: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,-warnings-as-errors]
static constexpr const char MAX_BRIGHTNESS[] = "max_brightness";
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:46:33: error: invalid case style for variable 'MAX_BRIGHTNESS' [readability-identifier-naming,-warnings-as-errors]
static constexpr const char MAX_BRIGHTNESS[] = "max_brightness";
^~~~~~~~~~~~~~
maxBrightness
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:47:28: error: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,-warnings-as-errors]
static constexpr const char TRIGGER[] = "trigger";
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:47:33: error: invalid case style for variable 'TRIGGER' [readability-identifier-naming,-warnings-as-errors]
static constexpr const char TRIGGER[] = "trigger";
^~~~~~~
trigger
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:48:28: error: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,-warnings-as-errors]
static constexpr const char DELAY_ON[] = "delay_on";
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:48:33: error: invalid case style for variable 'DELAY_ON' [readability-identifier-naming,-warnings-as-errors]
static constexpr const char DELAY_ON[] = "delay_on";
^~~~~~~~
delayOn
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:49:28: error: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,-warnings-as-errors]
static constexpr const char DELAY_OFF[] = "delay_off";
^
/home/andrew/src/openbmc/phosphor-led-sysfs/build/../sysfs.hpp:49:33: error: invalid case style for variable 'DELAY_OFF' [readability-identifier-naming,-warnings-as-errors]
static constexpr const char DELAY_OFF[] = "delay_off";
^~~~~~~~~
delayOff
../test/sysfs.cpp:62:46: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
std::array<const char *, 4> attrs = {BRIGHTNESS, TRIGGER, DELAY_ON, DELAY_OFF};
^
../test/sysfs.cpp:62:58: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
std::array<const char *, 4> attrs = {BRIGHTNESS, TRIGGER, DELAY_ON, DELAY_OFF};
^
../test/sysfs.cpp:62:67: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
std::array<const char *, 4> attrs = {BRIGHTNESS, TRIGGER, DELAY_ON, DELAY_OFF};
^
../test/sysfs.cpp:62:77: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
std::array<const char *, 4> attrs = {BRIGHTNESS, TRIGGER, DELAY_ON, DELAY_OFF};
^
```
Change-Id: I1df5f9b9f6a8c2073a0bc04ea5f88c580e2cb1b9
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/sysfs.hpp b/sysfs.hpp
index b65deff..a809378 100644
--- a/sysfs.hpp
+++ b/sysfs.hpp
@@ -42,11 +42,11 @@
virtual void setDelayOff(unsigned long ms);
protected:
- static constexpr char BRIGHTNESS[] = "brightness";
- static constexpr char MAX_BRIGHTNESS[] = "max_brightness";
- static constexpr char TRIGGER[] = "trigger";
- static constexpr char DELAY_ON[] = "delay_on";
- static constexpr char DELAY_OFF[] = "delay_off";
+ static constexpr const char* attrBrightness = "brightness";
+ static constexpr const char* attrMaxBrightness = "max_brightness";
+ static constexpr const char* attrTrigger = "trigger";
+ static constexpr const char* attrDelayOn = "delay_on";
+ static constexpr const char* attrDelayOff = "delay_off";
std::filesystem::path root;
};