fix: lint warnings from our clang-tidy enum cast check
I missed some cases in https://gerrit.lix.systems/c/lix/+/5490, which is not surprising given that I didn't have a lint for it at the time. Some of these have JSON deserializers, which is kind of scary (in that it was UB). Probably no impact, again, due to the lack of -fstrict-enums, but still, yikes! Change-Id: I895a8bfdd9972d8ade9fa6f5aa30845d6a6a6964
This commit is contained in:
@@ -53,7 +53,7 @@ public:
|
||||
ref<AttrCursor> getRoot();
|
||||
};
|
||||
|
||||
enum AttrType {
|
||||
enum AttrType : uint8_t {
|
||||
Placeholder = 0,
|
||||
FullAttrs = 1,
|
||||
String = 2,
|
||||
|
||||
@@ -284,6 +284,7 @@ private:
|
||||
|
||||
InternalType internalType() const
|
||||
{
|
||||
// NOLINTNEXTLINE(lix-cast-to-non-fixed-enum): TAG_MASK ensures it's in range
|
||||
return InternalType(raw & TAG_MASK);
|
||||
}
|
||||
|
||||
@@ -723,6 +724,8 @@ public:
|
||||
|
||||
Type type() const
|
||||
{
|
||||
// TAG_MASK == 7, max enumerator is 5, so all possible values are in range
|
||||
// NOLINTNEXTLINE(lix-cast-to-non-fixed-enum)
|
||||
return Type(raw & TAG_MASK);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace nix {
|
||||
|
||||
typedef enum {
|
||||
enum ActivityType : uint8_t {
|
||||
actUnknown = 0,
|
||||
actCopyPath = 100,
|
||||
actFileTransfer = 101,
|
||||
@@ -47,12 +47,12 @@ typedef enum {
|
||||
*/
|
||||
actPostBuildHook = 110,
|
||||
actBuildWaiting = 111,
|
||||
} ActivityType;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct json::is_integral_enum<ActivityType> : std::true_type {};
|
||||
|
||||
typedef enum {
|
||||
enum ResultType : uint8_t {
|
||||
/** Fields:
|
||||
* 0: int: bytes linked
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ typedef enum {
|
||||
* 0: string: last line
|
||||
*/
|
||||
resPostBuildLogLine = 107,
|
||||
} ResultType;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct json::is_integral_enum<ResultType> : std::true_type {};
|
||||
|
||||
Reference in New Issue
Block a user