Skip to content

Commit be0af2b

Browse files
committed
clang-tidy: bugprone-virtual-near-miss
A few virtual functions are called by constructors or destructors, which is dangerous in C++ (as an overridden virtual impl won't be called, only the one in the current class). Fix by either marking the function final or not calling at all (if possible).
1 parent ad44667 commit be0af2b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

include/frc2/command/ParallelCommandGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ParallelCommandGroup
8383
bool RunsWhenDisabled() const override;
8484

8585
private:
86-
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
86+
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
8787

8888
std::vector<std::pair<std::unique_ptr<Command>, bool>> m_commands;
8989
bool m_runWhenDisabled{true};

include/frc2/command/ParallelDeadlineGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class ParallelDeadlineGroup
9191
bool RunsWhenDisabled() const override;
9292

9393
private:
94-
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
94+
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
9595

9696
void SetDeadline(std::unique_ptr<Command>&& deadline);
9797

include/frc2/command/ParallelRaceGroup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ParallelRaceGroup
7171
bool RunsWhenDisabled() const override;
7272

7373
private:
74-
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) override;
74+
void AddCommands(std::vector<std::unique_ptr<Command>>&& commands) final;
7575

7676
std::vector<std::unique_ptr<Command>> m_commands;
7777
bool m_runWhenDisabled{true};

0 commit comments

Comments
 (0)