Clangtidy improvements (const & noexcept)

This commit is contained in:
GHOSCHT 2023-03-24 17:19:03 +01:00
parent b6fbafba76
commit c25eb340b1
2 changed files with 14 additions and 14 deletions

View file

@ -8,7 +8,7 @@ freertos::Task::Task(TaskFunction_t taskFunction, const etl::string_view name,
params, priority, &handle, coreID); params, priority, &handle, coreID);
} }
freertos::Task::Task(Task &&other) freertos::Task::Task(Task &&other) noexcept
: name{etl::move(other.name)}, handle{etl::move(other.handle)}, : name{etl::move(other.name)}, handle{etl::move(other.handle)},
stackDepth{etl::move(other.stackDepth)}, stackDepth{etl::move(other.stackDepth)},
priority{etl::move(other.priority)}, coreID{etl::move(other.coreID)} {} priority{etl::move(other.priority)}, coreID{etl::move(other.coreID)} {}
@ -19,7 +19,7 @@ freertos::Task::~Task() {
} }
} }
auto freertos::Task::operator=(const Task &&other) -> Task & { auto freertos::Task::operator=(const Task &&other) noexcept -> Task & {
name = etl::move(other.name); name = etl::move(other.name);
handle = etl::move(other.handle); handle = etl::move(other.handle);
stackDepth = etl::move(other.stackDepth); stackDepth = etl::move(other.stackDepth);
@ -28,16 +28,16 @@ auto freertos::Task::operator=(const Task &&other) -> Task & {
return *this; return *this;
} }
auto freertos::Task::getName() -> etl::string_view { return name; } auto freertos::Task::getName() const -> etl::string_view { return name; }
auto freertos::Task::getStackDepth() -> uint32_t { return stackDepth; } auto freertos::Task::getStackDepth() const -> uint32_t { return stackDepth; }
auto freertos::Task::getPriority() -> UBaseType_t { return priority; } auto freertos::Task::getPriority() const -> UBaseType_t { return priority; }
auto freertos::Task::setPriority(const UBaseType_t newPriority) -> void { auto freertos::Task::setPriority(const UBaseType_t newPriority) -> void {
vTaskPrioritySet(handle, newPriority); vTaskPrioritySet(handle, newPriority);
} }
auto freertos::Task::getCoreID() -> BaseType_t { return coreID; } auto freertos::Task::getCoreID() const -> BaseType_t { return coreID; }
auto freertos::Task::isValid() -> bool { return status == pdPASS; } auto freertos::Task::isValid() const -> bool { return status == pdPASS; }

View file

@ -9,17 +9,17 @@ public:
const uint32_t stackDepth, void *const params, UBaseType_t priority, const uint32_t stackDepth, void *const params, UBaseType_t priority,
const BaseType_t coreID); const BaseType_t coreID);
Task(const Task &other) = delete; Task(const Task &other) = delete;
Task(Task &&other); Task(Task &&other) noexcept;
~Task(); ~Task();
Task &operator=(const Task &other) = delete; Task &operator=(const Task &other) = delete;
Task &operator=(const Task &&other); Task &operator=(const Task &&other) noexcept;
etl::string_view getName(); etl::string_view getName() const;
uint32_t getStackDepth(); uint32_t getStackDepth() const;
UBaseType_t getPriority(); UBaseType_t getPriority() const;
void setPriority(const UBaseType_t newPriority); void setPriority(const UBaseType_t newPriority);
BaseType_t getCoreID(); BaseType_t getCoreID() const;
bool isValid(); bool isValid() const;
private: private:
etl::string_view name; etl::string_view name;