Skip to content

Commit 6c79da8

Browse files
committedApr 3, 2024··
clang-tidy: Fix new warnings from clang / LLVM 18
1 parent 158b609 commit 6c79da8

File tree

13 files changed

+30
-20
lines changed

13 files changed

+30
-20
lines changed
 

‎.clang-tidy

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"-readability-redundant-access-specifiers",
2222
"-readability-function-cognitive-complexity",
2323
"-readability-braces-around-statements",
24+
"-readability-redundant-member-init",
2425
],
2526
"HeaderFilterRegex": "src/.*hpp",
2627
"FormatStyle": "file",

‎src/common/casts.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace iptsd::casts {
1818

1919
template <class To, class From>
20-
constexpr inline To to(const From value)
20+
constexpr To to(const From value)
2121
{
2222
static_assert(!std::is_same_v<From, f64> || !std::is_same_v<To, f32>,
2323
"f64 to f32 cannot be narrowed safely. Please use gsl::narrow_cast!");
@@ -32,19 +32,19 @@ constexpr inline To to(const From value)
3232
}
3333

3434
template <class T>
35-
constexpr inline std::make_signed_t<T> to_signed(const T value)
35+
constexpr std::make_signed_t<T> to_signed(const T value)
3636
{
3737
return to<std::make_signed_t<T>>(value);
3838
}
3939

4040
template <class T>
41-
constexpr inline std::make_unsigned_t<T> to_unsigned(const T value)
41+
constexpr std::make_unsigned_t<T> to_unsigned(const T value)
4242
{
4343
return to<std::make_unsigned_t<T>>(value);
4444
}
4545

4646
template <class T>
47-
constexpr inline Eigen::Index to_eigen(const T value)
47+
constexpr Eigen::Index to_eigen(const T value)
4848
{
4949
return to<Eigen::Index>(value);
5050
}
@@ -57,7 +57,7 @@ constexpr inline Eigen::Index to_eigen(const T value)
5757
* @return A copy of the value of the packed field.
5858
*/
5959
template <class T>
60-
constexpr inline T unpack(const T packed)
60+
constexpr T unpack(const T packed)
6161
{
6262
return packed;
6363
}

‎src/common/constants.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <type_traits>
77

88
template <class T>
9-
constexpr inline T Zero()
9+
constexpr T Zero()
1010
{
1111
if constexpr (std::is_scalar_v<T>)
1212
return static_cast<T>(0);
@@ -15,7 +15,7 @@ constexpr inline T Zero()
1515
}
1616

1717
template <class T>
18-
constexpr inline T One()
18+
constexpr T One()
1919
{
2020
if constexpr (std::is_scalar_v<T>)
2121
return static_cast<T>(1);

‎src/common/reader.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace iptsd {
1414
namespace impl {
1515

16-
enum class ReaderError {
16+
enum class ReaderError : u8 {
1717
EndOfBuffer,
1818
};
1919

‎src/contacts/detection/algorithms/errors.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#ifndef IPTSD_CONTACTS_DETECTION_ALGORITHMS_ERRORS_HPP
44
#define IPTSD_CONTACTS_DETECTION_ALGORITHMS_ERRORS_HPP
55

6+
#include <common/types.hpp>
7+
68
#include <string>
79

810
namespace iptsd::contacts::detection {
911

10-
enum class Error {
12+
enum class Error : u8 {
1113
InvalidNeutralMode,
1214
InvalidClusterOverlap,
1315
FailedToMergeClusters,

‎src/contacts/detection/algorithms/neutral.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typename DenseBase<Derived>::Scalar statistical_mode(const DenseBase<Derived> &d
5151
/*
5252
* The algorithm that will be used to calculate the neutral value.
5353
*/
54-
enum class Algorithm {
54+
enum class Algorithm : u8 {
5555
// The most common element (statistical mode) will be used.
5656
MODE,
5757

‎src/core/generic/errors.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#ifndef IPTSD_CORE_GENERIC_ERRORS_HPP
44
#define IPTSD_CORE_GENERIC_ERRORS_HPP
55

6+
#include <common/types.hpp>
7+
68
#include <string>
79

810
namespace iptsd::core {
911

10-
enum class Error {
12+
enum class Error : u8 {
1113
InvalidScreenSize,
1214
InvalidNeutralValueAlgorithm,
1315
};

‎src/core/linux/errors.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#ifndef IPTSD_CORE_LINUX_ERRORS_HPP
44
#define IPTSD_CORE_LINUX_ERRORS_HPP
55

6+
#include <common/types.hpp>
7+
68
#include <string>
79

810
namespace iptsd::core::linux {
911

10-
enum class Error {
12+
enum class Error : u8 {
1113
ParsingFailed,
1214
ParsingTypeNotImplemented,
1315
RunnerInitError,

‎src/hid/errors.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#ifndef IPTSD_HID_ERRORS_HPP
44
#define IPTSD_HID_ERRORS_HPP
55

6+
#include <common/types.hpp>
7+
68
#include <string>
79

810
namespace iptsd::hid {
911

10-
enum class Error {
12+
enum class Error : u8 {
1113
ReportMergeTypes,
1214
ReportMergeIDs,
1315
UsageBeforePage,

‎src/hid/report.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace iptsd::hid {
1919
/*
2020
* The type of a report.
2121
*/
22-
enum class ReportType {
22+
enum class ReportType : u8 {
2323
// Data that is coming from the device
2424
Input,
2525

‎src/hid/spec.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ constexpr static u8 SHIFT_SIZE = 0;
1818
/*
1919
* 6.2.2.2 Short Items
2020
*/
21-
enum class ItemType {
21+
enum class ItemType : u8 {
2222
Main = 0,
2323
Global = 1,
2424
Local = 2,
@@ -28,22 +28,22 @@ enum class ItemType {
2828
/*
2929
* 6.2.2.4 Main Items
3030
*/
31-
enum class TagMain {
31+
enum class TagMain : u8 {
3232
Input = 0b1000,
3333
Output = 0b1001,
3434
Feature = 0b1011,
3535
Collection = 0b1010,
3636
EndCollection = 0b1100,
3737
};
3838

39-
enum class TagGlobal {
39+
enum class TagGlobal : u8 {
4040
UsagePage = 0b0000,
4141
ReportSize = 0b0111,
4242
ReportId = 0b1000,
4343
ReportCount = 0b1001,
4444
};
4545

46-
enum class TagLocal {
46+
enum class TagLocal : u8 {
4747
Usage = 0b0000,
4848
UsageMinimum = 0b0001,
4949
UsageMaximum = 0b0010,

‎src/ipts/device.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace iptsd::ipts {
2424
namespace impl {
2525

26-
enum class DeviceError {
26+
enum class DeviceError : u8 {
2727
InvalidDevice,
2828
InvalidSetModeReport,
2929
};
@@ -42,7 +42,7 @@ inline std::string format_as(DeviceError err)
4242

4343
} // namespace impl
4444

45-
enum class Mode {
45+
enum class Mode : u8 {
4646
Singletouch = 0,
4747
Multitouch = 1,
4848
};

‎src/ipts/protocol/legacy.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct [[gnu::packed]] Header {
3232
};
3333
static_assert(sizeof(Header) == 12);
3434

35+
// NOLINTNEXTLINE(performance-enum-size)
3536
enum class GroupType : u16 {
3637
//! The group contains report frames with stylus data.
3738
Stylus = 0x6,

0 commit comments

Comments
 (0)
Please sign in to comment.