diff --git a/lix/libexpr/eval-cache.hh b/lix/libexpr/eval-cache.hh index bd8541b49..5135b0fac 100644 --- a/lix/libexpr/eval-cache.hh +++ b/lix/libexpr/eval-cache.hh @@ -53,7 +53,7 @@ public: ref getRoot(); }; -enum AttrType { +enum AttrType : uint8_t { Placeholder = 0, FullAttrs = 1, String = 2, diff --git a/lix/libexpr/value.hh b/lix/libexpr/value.hh index bf20f2c5f..0e92e08d5 100644 --- a/lix/libexpr/value.hh +++ b/lix/libexpr/value.hh @@ -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); } }; diff --git a/lix/libutil/logging.hh b/lix/libutil/logging.hh index 0e4a0ae9b..a1103a29c 100644 --- a/lix/libutil/logging.hh +++ b/lix/libutil/logging.hh @@ -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 : 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 : std::true_type {};