mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Finish clang-tidy cleanups (#3003)
* Add .clang-tidy configuration. * A separate .clang-tidy is used for hal includes to suppress modernize-use-using (as these are C headers). * Add NOLINT where necessary for a clean run. * Add clang-tidy job to lint-format workflow. This workflow is now only run on PRs. To reduce runtime, clang-tidy is only run on files changed in the PR. Two wpilibc changes; both are unlikely to break user code: * BuiltInAccelerometer: Make SetRange() final * Counter: Make SetMaxPeriod() final After these cleanups, the only file that does not run cleanly is cscore_raw_cv.h due to it not being standalone.
This commit is contained in:
76
.clang-tidy
Normal file
76
.clang-tidy
Normal file
@@ -0,0 +1,76 @@
|
||||
Checks:
|
||||
'bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-dynamic-static-initializers,
|
||||
bugprone-exception-escape,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-forwarding-reference-overload,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-lambda-function-name,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-posix-return,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-spuriously-wake-up-functions,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-include,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unused-raii,
|
||||
bugprone-virtual-near-miss,
|
||||
cert-dcl58-cpp,
|
||||
cert-err52-cpp,
|
||||
cert-err60-cpp,
|
||||
cert-mem57-cpp,
|
||||
cert-oop57-cpp,
|
||||
cert-oop58-cpp,
|
||||
clang-diagnostic-*,
|
||||
-clang-diagnostic-deprecated-declarations,
|
||||
-clang-diagnostic-#warnings,
|
||||
-clang-diagnostic-pedantic,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-slicing,
|
||||
google-build-namespaces,
|
||||
google-explicit-constructor,
|
||||
google-global-names-in-headers,
|
||||
google-readability-avoid-underscore-in-googletest-name,
|
||||
google-readability-casting,
|
||||
google-runtime-operator,
|
||||
llvm-twine-local,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
misc-non-copyable-objects,
|
||||
modernize-avoid-bind,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-pass-by-value,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
modernize-use-using,
|
||||
readability-braces-around-statements'
|
||||
FormatStyle: file
|
||||
CheckOptions:
|
||||
- key: bugprone-dangling-handle
|
||||
value: 'wpi::StringRef;wpi::Twine'
|
||||
29
.github/workflows/lint-format.yml
vendored
29
.github/workflows/lint-format.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Lint and Format
|
||||
|
||||
on: [pull_request, push]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
wpiformat:
|
||||
@@ -18,10 +18,35 @@ jobs:
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install clang-format
|
||||
run: sudo apt-get update -q && sudo apt-get install clang-format-10
|
||||
run: sudo apt-get update -q && sudo apt-get install -y clang-format-10
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat
|
||||
- name: Run
|
||||
run: wpiformat -clang 10
|
||||
- name: Check Output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
tidy:
|
||||
name: "clang-tidy"
|
||||
runs-on: ubuntu-latest
|
||||
container: wpilib/roborio-cross-ubuntu:2020-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Fetch all history and metadata
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
git checkout -b pr
|
||||
git branch -f master origin/master
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Install clang-format and clang-tidy
|
||||
run: sudo apt-get update -q && sudo apt-get install -y clang-format-10 clang-tidy-10
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat
|
||||
- name: Create compile_commands.json
|
||||
run: mkdir build-cmake && cd build-cmake && cmake -DWITH_OLD_COMMANDS=ON -DWITH_EXAMPLES=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=YES ..
|
||||
- name: List changed files
|
||||
run: wpiformat -list-changed-files
|
||||
- name: Run clang-tidy
|
||||
run: wpiformat -clang 10 -no-format -tidy-changed -compile-commands=build-cmake
|
||||
|
||||
@@ -65,12 +65,11 @@ bool GetJpegSize(wpi::StringRef data, int* width, int* height) {
|
||||
}
|
||||
|
||||
data = data.substr(2); // Get to the first block
|
||||
auto bytes = data.bytes_begin();
|
||||
for (;;) {
|
||||
if (data.size() < 4) {
|
||||
return false; // EOF
|
||||
}
|
||||
bytes = data.bytes_begin();
|
||||
auto bytes = data.bytes_begin();
|
||||
if (bytes[0] != 0xff) {
|
||||
return false; // not a tag
|
||||
}
|
||||
@@ -104,12 +103,11 @@ bool JpegNeedsDHT(const char* data, size_t* size, size_t* locSOF) {
|
||||
|
||||
// Search until SOS for DHT tag
|
||||
sdata = sdata.substr(2); // Get to the first block
|
||||
auto bytes = sdata.bytes_begin();
|
||||
for (;;) {
|
||||
if (sdata.size() < 4) {
|
||||
return false; // EOF
|
||||
}
|
||||
bytes = sdata.bytes_begin();
|
||||
auto bytes = sdata.bytes_begin();
|
||||
if (bytes[0] != 0xff) {
|
||||
return false; // not a tag
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ class JCSGlobal {
|
||||
jvm->DetachCurrentThread();
|
||||
}
|
||||
}
|
||||
operator T() { return m_obj; }
|
||||
operator T() { return m_obj; } // NOLINT
|
||||
T obj() { return m_obj; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -30,18 +30,18 @@ class ComPtr {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ComPtr(const ComPtr<T>& other) noexcept : m_ptr(other.m_ptr) {
|
||||
ComPtr(const ComPtr<T>& other) noexcept : m_ptr(other.m_ptr) { // NOLINT
|
||||
InternalAddRef();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ComPtr(ComPtr<T>&& other) noexcept : m_ptr(other.m_ptr) {
|
||||
ComPtr(ComPtr<T>&& other) noexcept : m_ptr(other.m_ptr) { // NOLINT
|
||||
other.m_ptr = nullptr;
|
||||
}
|
||||
|
||||
~ComPtr() noexcept { InternalRelease(); }
|
||||
|
||||
ComPtr& operator=(const ComPtr& other) noexcept {
|
||||
ComPtr& operator=(const ComPtr& other) noexcept { // NOLINT
|
||||
InternalCopy(other.m_ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ bool DataSource::InputInt(const char* label, int* v, int step, int step_fast,
|
||||
void DataSource::EmitDrag(ImGuiDragDropFlags flags) const {
|
||||
if (ImGui::BeginDragDropSource(flags)) {
|
||||
auto self = this;
|
||||
ImGui::SetDragDropPayload("DataSource", &self, sizeof(self));
|
||||
ImGui::SetDragDropPayload("DataSource", &self, sizeof(self)); // NOLINT
|
||||
const char* name = GetName();
|
||||
ImGui::TextUnformatted(name[0] == '\0' ? m_id.c_str() : name);
|
||||
ImGui::EndDragDropSource();
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
using namespace glass;
|
||||
|
||||
LogData::LogData(size_t maxLines) : m_maxLines{maxLines} {}
|
||||
|
||||
void LogData::Clear() {
|
||||
m_buf.clear();
|
||||
m_lineOffsets.clear();
|
||||
|
||||
@@ -16,7 +16,7 @@ class LogData {
|
||||
friend void DisplayLog(LogData*, bool);
|
||||
|
||||
public:
|
||||
explicit LogData(size_t maxLines = 10000) : m_maxLines{maxLines} {}
|
||||
explicit LogData(size_t maxLines = 10000);
|
||||
|
||||
void Clear();
|
||||
void Append(const wpi::Twine& msg);
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace hal {
|
||||
namespace init {
|
||||
namespace hal::init {
|
||||
extern std::atomic_bool HAL_IsInitialized;
|
||||
extern void RunInitialize();
|
||||
static inline void CheckInit() {
|
||||
inline void CheckInit() {
|
||||
if (HAL_IsInitialized.load(std::memory_order_relaxed)) {
|
||||
return;
|
||||
}
|
||||
@@ -52,5 +51,4 @@ extern void InitializeSerialPort();
|
||||
extern void InitializeSolenoid();
|
||||
extern void InitializeSPI();
|
||||
extern void InitializeThreads();
|
||||
} // namespace init
|
||||
} // namespace hal
|
||||
} // namespace hal::init
|
||||
|
||||
@@ -155,7 +155,7 @@ void SerialHelper::CoiteratedSort(
|
||||
}
|
||||
}
|
||||
}
|
||||
vec = sortedVec;
|
||||
vec.swap(sortedVec);
|
||||
}
|
||||
|
||||
void SerialHelper::QueryHubPaths(int32_t* status) {
|
||||
|
||||
75
hal/src/main/native/include/hal/.clang-tidy
Normal file
75
hal/src/main/native/include/hal/.clang-tidy
Normal file
@@ -0,0 +1,75 @@
|
||||
Checks:
|
||||
'bugprone-assert-side-effect,
|
||||
bugprone-bool-pointer-implicit-conversion,
|
||||
bugprone-copy-constructor-init,
|
||||
bugprone-dangling-handle,
|
||||
bugprone-dynamic-static-initializers,
|
||||
bugprone-exception-escape,
|
||||
bugprone-forward-declaration-namespace,
|
||||
bugprone-forwarding-reference-overload,
|
||||
bugprone-inaccurate-erase,
|
||||
bugprone-incorrect-roundings,
|
||||
bugprone-integer-division,
|
||||
bugprone-lambda-function-name,
|
||||
bugprone-misplaced-operator-in-strlen-in-alloc,
|
||||
bugprone-misplaced-widening-cast,
|
||||
bugprone-move-forwarding-reference,
|
||||
bugprone-multiple-statement-macro,
|
||||
bugprone-parent-virtual-call,
|
||||
bugprone-posix-return,
|
||||
bugprone-sizeof-container,
|
||||
bugprone-sizeof-expression,
|
||||
bugprone-spuriously-wake-up-functions,
|
||||
bugprone-string-constructor,
|
||||
bugprone-string-integer-assignment,
|
||||
bugprone-string-literal-with-embedded-nul,
|
||||
bugprone-suspicious-enum-usage,
|
||||
bugprone-suspicious-include,
|
||||
bugprone-suspicious-memset-usage,
|
||||
bugprone-suspicious-missing-comma,
|
||||
bugprone-suspicious-semicolon,
|
||||
bugprone-suspicious-string-compare,
|
||||
bugprone-throw-keyword-missing,
|
||||
bugprone-too-small-loop-variable,
|
||||
bugprone-undefined-memory-manipulation,
|
||||
bugprone-undelegated-constructor,
|
||||
bugprone-unhandled-self-assignment,
|
||||
bugprone-unused-raii,
|
||||
bugprone-virtual-near-miss,
|
||||
cert-dcl58-cpp,
|
||||
cert-err52-cpp,
|
||||
cert-err60-cpp,
|
||||
cert-mem57-cpp,
|
||||
cert-oop57-cpp,
|
||||
cert-oop58-cpp,
|
||||
clang-diagnostic-*,
|
||||
-clang-diagnostic-deprecated-declarations,
|
||||
-clang-diagnostic-#warnings,
|
||||
-clang-diagnostic-pedantic,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-slicing,
|
||||
google-build-namespaces,
|
||||
google-explicit-constructor,
|
||||
google-global-names-in-headers,
|
||||
google-readability-avoid-underscore-in-googletest-name,
|
||||
google-readability-casting,
|
||||
google-runtime-operator,
|
||||
llvm-twine-local,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
misc-non-copyable-objects,
|
||||
modernize-avoid-bind,
|
||||
modernize-concat-nested-namespaces,
|
||||
modernize-make-shared,
|
||||
modernize-make-unique,
|
||||
modernize-pass-by-value,
|
||||
modernize-use-default-member-init,
|
||||
modernize-use-noexcept,
|
||||
modernize-use-nullptr,
|
||||
modernize-use-override,
|
||||
readability-braces-around-statements'
|
||||
FormatStyle: file
|
||||
CheckOptions:
|
||||
- key: bugprone-dangling-handle
|
||||
value: 'wpi::StringRef;wpi::Twine'
|
||||
@@ -125,9 +125,8 @@ static inline bool isHandleCorrectVersion(HAL_Handle handle, int16_t version) {
|
||||
* @return true if the handle is proper version and type, otherwise
|
||||
* false.
|
||||
*/
|
||||
static inline int16_t getHandleTypedIndex(HAL_Handle handle,
|
||||
HAL_HandleEnum enumType,
|
||||
int16_t version) {
|
||||
inline int16_t getHandleTypedIndex(HAL_Handle handle, HAL_HandleEnum enumType,
|
||||
int16_t version) {
|
||||
if (!isHandleType(handle, enumType)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -155,7 +154,7 @@ static inline int16_t getHandleTypedIndex(HAL_Handle handle,
|
||||
* @param handle the port handle
|
||||
* @return the port channel
|
||||
*/
|
||||
static inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -169,7 +168,7 @@ static inline int16_t getPortHandleChannel(HAL_PortHandle handle) {
|
||||
* @param handle the port handle
|
||||
* @return the port module
|
||||
*/
|
||||
static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
@@ -183,7 +182,7 @@ static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
* @param handle the port handle
|
||||
* @return the port SPI channel
|
||||
*/
|
||||
static inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
|
||||
inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) {
|
||||
return InvalidHandleIndex;
|
||||
}
|
||||
|
||||
@@ -108,104 +108,104 @@ typedef enum {
|
||||
* Represents the resulting status of a function call through its return value.
|
||||
* 0 is success, negative values are errors, and positive values are warnings.
|
||||
*/
|
||||
typedef int32_t NiFpga_Status;
|
||||
typedef int32_t NiFpga_Status; // NOLINT
|
||||
|
||||
/**
|
||||
* No errors or warnings.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_Success = 0;
|
||||
constexpr NiFpga_Status NiFpga_Status_Success = 0;
|
||||
|
||||
/**
|
||||
* The timeout expired before the FIFO operation could complete.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoTimeout = -50400;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoTimeout = -50400;
|
||||
|
||||
/**
|
||||
* No transfer is in progress because the transfer was aborted by the client.
|
||||
* The operation could not be completed as specified.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_TransferAborted = -50405;
|
||||
constexpr NiFpga_Status NiFpga_Status_TransferAborted = -50405;
|
||||
|
||||
/**
|
||||
* A memory allocation failed. Try again after rebooting.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_MemoryFull = -52000;
|
||||
constexpr NiFpga_Status NiFpga_Status_MemoryFull = -52000;
|
||||
|
||||
/**
|
||||
* An unexpected software error occurred.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_SoftwareFault = -52003;
|
||||
constexpr NiFpga_Status NiFpga_Status_SoftwareFault = -52003;
|
||||
|
||||
/**
|
||||
* A parameter to a function was not valid. This could be a NULL pointer, a bad
|
||||
* value, etc.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidParameter = -52005;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidParameter = -52005;
|
||||
|
||||
/**
|
||||
* A required resource was not found. The NiFpga.* library, the RIO resource, or
|
||||
* some other resource may be missing.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResourceNotFound = -52006;
|
||||
constexpr NiFpga_Status NiFpga_Status_ResourceNotFound = -52006;
|
||||
|
||||
/**
|
||||
* A required resource was not properly initialized. This could occur if
|
||||
* NiFpga_Initialize was not called or a required NiFpga_IrqContext was not
|
||||
* reserved.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010;
|
||||
constexpr NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010;
|
||||
|
||||
/**
|
||||
* A hardware failure has occurred. The operation could not be completed as
|
||||
* specified.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_HardwareFault = -52018;
|
||||
constexpr NiFpga_Status NiFpga_Status_HardwareFault = -52018;
|
||||
|
||||
/**
|
||||
* The FPGA is already running.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003;
|
||||
|
||||
/**
|
||||
* An error occurred downloading the VI to the FPGA device. Verify that
|
||||
* the target is connected and powered and that the resource of the target
|
||||
* is properly configured.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_DownloadError = -61018;
|
||||
constexpr NiFpga_Status NiFpga_Status_DownloadError = -61018;
|
||||
|
||||
/**
|
||||
* The bitfile was not compiled for the specified resource's device type.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024;
|
||||
constexpr NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024;
|
||||
|
||||
/**
|
||||
* An error was detected in the communication between the host computer and the
|
||||
* FPGA target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046;
|
||||
constexpr NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046;
|
||||
|
||||
/**
|
||||
* The timeout expired before any of the IRQs were asserted.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_IrqTimeout = -61060;
|
||||
constexpr NiFpga_Status NiFpga_Status_IrqTimeout = -61060;
|
||||
|
||||
/**
|
||||
* The specified bitfile is invalid or corrupt.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_CorruptBitfile = -61070;
|
||||
constexpr NiFpga_Status NiFpga_Status_CorruptBitfile = -61070;
|
||||
|
||||
/**
|
||||
* The requested FIFO depth is invalid. It is either 0 or an amount not
|
||||
* supported by the hardware.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BadDepth = -61072;
|
||||
constexpr NiFpga_Status NiFpga_Status_BadDepth = -61072;
|
||||
|
||||
/**
|
||||
* The number of FIFO elements is invalid. Either the number is greater than the
|
||||
* depth of the host memory DMA FIFO, or more elements were requested for
|
||||
* release than had been acquired.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
constexpr NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
|
||||
/**
|
||||
* A hardware clocking error occurred. A derived clock lost lock with its base
|
||||
@@ -218,62 +218,62 @@ static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073;
|
||||
* generated from free-running, on-board sources, please contact National
|
||||
* Instruments technical support at ni.com/support.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ClockLostLock = -61083;
|
||||
constexpr NiFpga_Status NiFpga_Status_ClockLostLock = -61083;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy. Stop all
|
||||
* activities on the FPGA before requesting this operation. If the target is in
|
||||
* Scan Interface programming mode, put it in FPGA Interface programming mode.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusy = -61141;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusy = -61141;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* FPGA Interface C API mode. Stop all activities on the FPGA before requesting
|
||||
* this operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200;
|
||||
|
||||
/**
|
||||
* The chassis is in Scan Interface programming mode. In order to run FPGA VIs,
|
||||
* you must go to the chassis properties page, select FPGA programming mode, and
|
||||
* deploy settings.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* FPGA Interface mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* Interactive mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203;
|
||||
|
||||
/**
|
||||
* The operation could not be performed because the FPGA is busy operating in
|
||||
* Emulation mode. Stop all activities on the FPGA before requesting this
|
||||
* operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204;
|
||||
|
||||
/**
|
||||
* LabVIEW FPGA does not support the Reset method for bitfiles that allow
|
||||
* removal of implicit enable signals in single-cycle Timed Loops.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval =
|
||||
constexpr NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval =
|
||||
-61211;
|
||||
|
||||
/**
|
||||
* LabVIEW FPGA does not support the Abort method for bitfiles that allow
|
||||
* removal of implicit enable signals in single-cycle Timed Loops.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
constexpr NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
-61212;
|
||||
|
||||
/**
|
||||
@@ -282,7 +282,7 @@ static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval =
|
||||
* Pass the NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close
|
||||
* instead of 0.
|
||||
*/
|
||||
static const NiFpga_Status
|
||||
constexpr NiFpga_Status
|
||||
NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213;
|
||||
|
||||
/**
|
||||
@@ -290,14 +290,14 @@ static const NiFpga_Status
|
||||
* Timed Loops, LabVIEW FPGA does not support this method prior to running the
|
||||
* bitfile.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun =
|
||||
constexpr NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun =
|
||||
-61214;
|
||||
|
||||
/**
|
||||
* Bitfiles that allow removal of implicit enable signals in single-cycle Timed
|
||||
* Loops can run only once. Download the bitfile again before re-running the VI.
|
||||
*/
|
||||
static const NiFpga_Status
|
||||
constexpr NiFpga_Status
|
||||
NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215;
|
||||
|
||||
/**
|
||||
@@ -306,8 +306,7 @@ static const NiFpga_Status
|
||||
* protocol. If you are generating your clocks internally, please contact
|
||||
* National Instruments Technical Support.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation =
|
||||
-61216;
|
||||
constexpr NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216;
|
||||
|
||||
/**
|
||||
* The number of elements requested must be less than or equal to the number of
|
||||
@@ -315,7 +314,7 @@ static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation =
|
||||
* fewer unacquired elements left in the FIFO than are being requested. Release
|
||||
* some acquired elements before acquiring more elements.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
constexpr NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
-61219;
|
||||
|
||||
/**
|
||||
@@ -323,12 +322,12 @@ static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired =
|
||||
* discovery mode. Wait for configuration or discovery to complete and retry
|
||||
* your operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252;
|
||||
constexpr NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252;
|
||||
|
||||
/**
|
||||
* An unexpected internal error occurred.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
constexpr NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
|
||||
/**
|
||||
* The NI-RIO driver was unable to allocate memory for a FIFO. This can happen
|
||||
@@ -337,52 +336,52 @@ static const NiFpga_Status NiFpga_Status_InternalError = -61499;
|
||||
* to reconfigure the controller with a greater maximum FIFO depth. For more
|
||||
* information, refer to the NI KnowledgeBase article 65OF2ERQ.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003;
|
||||
constexpr NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003;
|
||||
|
||||
/**
|
||||
* Access to the remote system was denied. Use MAX to check the Remote Device
|
||||
* Access settings under Software>>NI-RIO>>NI-RIO Settings on the remote system.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_AccessDenied = -63033;
|
||||
constexpr NiFpga_Status NiFpga_Status_AccessDenied = -63033;
|
||||
|
||||
/**
|
||||
* The NI-RIO software on the host is not compatible with the software on the
|
||||
* target. Upgrade the NI-RIO software on the host in order to connect to this
|
||||
* target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038;
|
||||
constexpr NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038;
|
||||
|
||||
/**
|
||||
* A connection could not be established to the specified remote device. Ensure
|
||||
* that the device is on and accessible over the network, that NI-RIO software
|
||||
* is installed, and that the RIO server is running and properly configured.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040;
|
||||
constexpr NiFpga_Status NiFpga_Status_RpcConnectionError = -63040;
|
||||
|
||||
/**
|
||||
* The RPC session is invalid. The target may have reset or been rebooted. Check
|
||||
* the network connection and retry the operation.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043;
|
||||
constexpr NiFpga_Status NiFpga_Status_RpcSessionError = -63043;
|
||||
|
||||
/**
|
||||
* The operation could not complete because another session is accessing the
|
||||
* FIFO. Close the other session and retry.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoReserved = -63082;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoReserved = -63082;
|
||||
|
||||
/**
|
||||
* A Configure FIFO, Stop FIFO, Read FIFO, or Write FIFO function was called
|
||||
* while the host had acquired elements of the FIFO. Release all acquired
|
||||
* elements before configuring, stopping, reading, or writing.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083;
|
||||
constexpr NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083;
|
||||
|
||||
/**
|
||||
* A function was called using a misaligned address. The address must be a
|
||||
* multiple of the size of the datatype.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
constexpr NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
|
||||
/**
|
||||
* The FPGA Read/Write Control Function is accessing a control or indicator
|
||||
@@ -390,7 +389,7 @@ static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084;
|
||||
* Refer to the hardware documentation for the limitations on data types for
|
||||
* this target.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
constexpr NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
|
||||
/**
|
||||
* A valid .lvbitx bitfile is required. If you are using a valid .lvbitx
|
||||
@@ -398,14 +397,14 @@ static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085;
|
||||
* Determine which version of LabVIEW was used to make the bitfile, update your
|
||||
* software to that version or later, and try again.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101;
|
||||
constexpr NiFpga_Status NiFpga_Status_BitfileReadError = -63101;
|
||||
|
||||
/**
|
||||
* The specified signature does not match the signature of the bitfile. If the
|
||||
* bitfile has been recompiled, regenerate the C API and rebuild the
|
||||
* application.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
constexpr NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
|
||||
/**
|
||||
* The bitfile you are trying to use is incompatible with the version
|
||||
@@ -415,33 +414,33 @@ static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106;
|
||||
* with the same version of NI-RIO that is currently installed on the
|
||||
* target and/or host.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107;
|
||||
constexpr NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107;
|
||||
|
||||
/**
|
||||
* Either the supplied resource name is invalid as a RIO resource name, or the
|
||||
* device was not found. Use MAX to find the proper resource name for the
|
||||
* intended device.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidResourceName = -63192;
|
||||
|
||||
/**
|
||||
* The requested feature is not supported.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193;
|
||||
constexpr NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193;
|
||||
|
||||
/**
|
||||
* The NI-RIO software on the target system is not compatible with this
|
||||
* software. Upgrade the NI-RIO software on the target system.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194;
|
||||
constexpr NiFpga_Status NiFpga_Status_VersionMismatch = -63194;
|
||||
|
||||
/**
|
||||
* The session is invalid or has been closed.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_InvalidSession = -63195;
|
||||
constexpr NiFpga_Status NiFpga_Status_InvalidSession = -63195;
|
||||
|
||||
/**
|
||||
* The maximum number of open FPGA sessions has been reached. Close some open
|
||||
* sessions.
|
||||
*/
|
||||
static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198;
|
||||
constexpr NiFpga_Status NiFpga_Status_OutOfHandles = -63198;
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace hal {
|
||||
namespace init {
|
||||
namespace hal::init {
|
||||
extern std::atomic_bool HAL_IsInitialized;
|
||||
extern void RunInitialize();
|
||||
static inline void CheckInit() {
|
||||
inline void CheckInit() {
|
||||
if (HAL_IsInitialized.load(std::memory_order_relaxed)) {
|
||||
return;
|
||||
}
|
||||
@@ -74,5 +73,4 @@ extern void InitializeSolenoid();
|
||||
extern void InitializeSPI();
|
||||
extern void InitializeThreads();
|
||||
|
||||
} // namespace init
|
||||
} // namespace hal
|
||||
} // namespace hal::init
|
||||
|
||||
@@ -73,5 +73,6 @@ TEST(AnalogInSimTests, TestAnalogInInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != analogInHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestAnalogInCallbackName.c_str());
|
||||
HALSIM_CancelAnalogInInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -73,5 +73,6 @@ TEST(AnalogOutSimTests, TestAnalogOutInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != analogOutHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestAnalogOutCallbackName.c_str());
|
||||
HALSIM_CancelAnalogOutInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -73,6 +73,7 @@ TEST(DigitalIoSimTests, TestDigitalIoInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != digitalIoHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestDigitalIoCallbackName.c_str());
|
||||
HALSIM_CancelDIOInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
@@ -71,5 +71,6 @@ TEST(PWMSimTests, TestPwmInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != pwmHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("Initialized", gTestPwmCallbackName.c_str());
|
||||
HALSIM_CancelPWMInitializedCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
} // namespace hal
|
||||
|
||||
@@ -71,6 +71,7 @@ TEST(RelaySimTests, TestRelayInitialization) {
|
||||
EXPECT_TRUE(HAL_kInvalidHandle != pdpHandle);
|
||||
EXPECT_EQ(0, status);
|
||||
EXPECT_STREQ("InitializedForward", gTestRelayCallbackName.c_str());
|
||||
HALSIM_CancelRelayInitializedForwardCallback(INDEX_TO_TEST, callbackId);
|
||||
}
|
||||
|
||||
} // namespace hal
|
||||
|
||||
@@ -448,10 +448,10 @@ void DispatcherBase::ServerThreadMain() {
|
||||
using namespace std::placeholders;
|
||||
auto conn = std::make_shared<NetworkConnection>(
|
||||
++m_connections_uid, std::move(stream), m_notifier, m_logger,
|
||||
std::bind(&Dispatcher::ServerHandshake, this, _1, _2, _3),
|
||||
std::bind(&IStorage::GetMessageEntryType, &m_storage, _1));
|
||||
std::bind(&Dispatcher::ServerHandshake, this, _1, _2, _3), // NOLINT
|
||||
std::bind(&IStorage::GetMessageEntryType, &m_storage, _1)); // NOLINT
|
||||
conn->set_process_incoming(
|
||||
std::bind(&IStorage::ProcessIncoming, &m_storage, _1, _2,
|
||||
std::bind(&IStorage::ProcessIncoming, &m_storage, _1, _2, // NOLINT
|
||||
std::weak_ptr<NetworkConnection>(conn)));
|
||||
{
|
||||
std::scoped_lock lock(m_user_mutex);
|
||||
@@ -507,10 +507,10 @@ void DispatcherBase::ClientThreadMain() {
|
||||
using namespace std::placeholders;
|
||||
auto conn = std::make_shared<NetworkConnection>(
|
||||
++m_connections_uid, std::move(stream), m_notifier, m_logger,
|
||||
std::bind(&Dispatcher::ClientHandshake, this, _1, _2, _3),
|
||||
std::bind(&IStorage::GetMessageEntryType, &m_storage, _1));
|
||||
std::bind(&Dispatcher::ClientHandshake, this, _1, _2, _3), // NOLINT
|
||||
std::bind(&IStorage::GetMessageEntryType, &m_storage, _1)); // NOLINT
|
||||
conn->set_process_incoming(
|
||||
std::bind(&IStorage::ProcessIncoming, &m_storage, _1, _2,
|
||||
std::bind(&IStorage::ProcessIncoming, &m_storage, _1, _2, // NOLINT
|
||||
std::weak_ptr<NetworkConnection>(conn)));
|
||||
m_connections.resize(0); // disconnect any current
|
||||
m_connections.emplace_back(conn);
|
||||
|
||||
@@ -15,7 +15,8 @@ using namespace std::placeholders;
|
||||
|
||||
InstanceImpl::InstanceImpl(int inst)
|
||||
: logger_impl(inst),
|
||||
logger(std::bind(&LoggerImpl::Log, &logger_impl, _1, _2, _3, _4)),
|
||||
logger(
|
||||
std::bind(&LoggerImpl::Log, &logger_impl, _1, _2, _3, _4)), // NOLINT
|
||||
connection_notifier(inst),
|
||||
entry_notifier(inst, logger),
|
||||
rpc_server(inst, logger),
|
||||
|
||||
@@ -376,4 +376,4 @@ void NetworkConnection::PostOutgoing(bool keep_alive) {
|
||||
m_pending_update.resize(0);
|
||||
}
|
||||
m_last_post = now;
|
||||
}
|
||||
} // NOLINT
|
||||
|
||||
@@ -59,21 +59,21 @@ class NetworkConnection : public INetworkConnection {
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
ConnectionInfo info() const override;
|
||||
ConnectionInfo info() const final;
|
||||
|
||||
bool active() const { return m_active; }
|
||||
wpi::NetworkStream& stream() { return *m_stream; }
|
||||
|
||||
void QueueOutgoing(std::shared_ptr<Message> msg) override;
|
||||
void QueueOutgoing(std::shared_ptr<Message> msg) final;
|
||||
void PostOutgoing(bool keep_alive) override;
|
||||
|
||||
unsigned int uid() const { return m_uid; }
|
||||
|
||||
unsigned int proto_rev() const override;
|
||||
void set_proto_rev(unsigned int proto_rev) override;
|
||||
unsigned int proto_rev() const final;
|
||||
void set_proto_rev(unsigned int proto_rev) final;
|
||||
|
||||
State state() const override;
|
||||
void set_state(State state) override;
|
||||
State state() const final;
|
||||
void set_state(State state) final;
|
||||
|
||||
std::string remote_id() const;
|
||||
void set_remote_id(StringRef remote_id);
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace nt;
|
||||
|
||||
static void ConvertToC(wpi::StringRef in, char** out) {
|
||||
*out = static_cast<char*>(wpi::safe_malloc(in.size() + 1));
|
||||
std::memmove(*out, in.data(), in.size());
|
||||
std::memmove(*out, in.data(), in.size()); // NOLINT
|
||||
(*out)[in.size()] = '\0';
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ NT_Value** NT_UnpackRpcValues(const char* packed, size_t packed_len,
|
||||
|
||||
// create array and copy into it
|
||||
NT_Value** values = static_cast<NT_Value**>(
|
||||
wpi::safe_malloc(values_v.size() * sizeof(NT_Value*)));
|
||||
wpi::safe_malloc(values_v.size() * sizeof(NT_Value*))); // NOLINT
|
||||
for (size_t i = 0; i < values_v.size(); ++i) {
|
||||
values[i] = static_cast<NT_Value*>(wpi::safe_malloc(sizeof(NT_Value)));
|
||||
ConvertToC(*values_v[i], values[i]);
|
||||
|
||||
@@ -19,7 +19,7 @@ class ExternalLimitSwitch : public Switch {
|
||||
explicit ExternalLimitSwitch(sdf::ElementPtr sdf);
|
||||
|
||||
/// \brief Returns true when the switch is triggered.
|
||||
virtual bool Get();
|
||||
bool Get() override;
|
||||
|
||||
private:
|
||||
gazebo::sensors::ContactSensorPtr sensor;
|
||||
|
||||
@@ -18,7 +18,7 @@ class InternalLimitSwitch : public Switch {
|
||||
InternalLimitSwitch(gazebo::physics::ModelPtr model, sdf::ElementPtr sdf);
|
||||
|
||||
/// \brief Returns true when the switch is triggered.
|
||||
virtual bool Get();
|
||||
bool Get() override;
|
||||
|
||||
private:
|
||||
gazebo::physics::JointPtr joint;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class DSCommPacketTest : public ::testing::Test {
|
||||
public:
|
||||
DSCommPacketTest() {}
|
||||
DSCommPacketTest() = default;
|
||||
|
||||
void SendJoysticks() { commPacket.SendJoysticks(); }
|
||||
|
||||
|
||||
@@ -1295,7 +1295,7 @@ static void DisplaySystemJoystick(SystemJoystick& joy, int i) {
|
||||
// drag and drop sources are the low level joysticks
|
||||
if (ImGui::BeginDragDropSource()) {
|
||||
SystemJoystick* joyPtr = &joy;
|
||||
ImGui::SetDragDropPayload("Joystick", &joyPtr, sizeof(joyPtr));
|
||||
ImGui::SetDragDropPayload("Joystick", &joyPtr, sizeof(joyPtr)); // NOLINT
|
||||
ImGui::Text("%d: %s", i, joy.GetName());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
@@ -1325,7 +1325,8 @@ static void DisplayJoysticks() {
|
||||
if (!disableDS && joy.sys) {
|
||||
ImGui::Selectable(label, false);
|
||||
if (ImGui::BeginDragDropSource()) {
|
||||
ImGui::SetDragDropPayload("Joystick", &joy.sys, sizeof(joy.sys));
|
||||
ImGui::SetDragDropPayload("Joystick", &joy.sys,
|
||||
sizeof(joy.sys)); // NOLINT
|
||||
ImGui::Text("%d: %s", joy.sys->GetIndex(), joy.sys->GetName());
|
||||
ImGui::EndDragDropSource();
|
||||
}
|
||||
@@ -1335,7 +1336,7 @@ static void DisplayJoysticks() {
|
||||
if (!disableDS && ImGui::BeginDragDropTarget()) {
|
||||
if (const ImGuiPayload* payload =
|
||||
ImGui::AcceptDragDropPayload("Joystick")) {
|
||||
IM_ASSERT(payload->DataSize == sizeof(SystemJoystick*));
|
||||
IM_ASSERT(payload->DataSize == sizeof(SystemJoystick*)); // NOLINT
|
||||
SystemJoystick* payload_sys =
|
||||
*static_cast<SystemJoystick* const*>(payload->Data);
|
||||
// clear it from the other joysticks
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
|
||||
namespace wpilibws {
|
||||
|
||||
typedef void (*HALCbRegisterIndexedFunc)(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
using HALCbRegisterIndexedFunc = void (*)(int32_t index,
|
||||
HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
using HALCbRegisterSingleFunc = void (*)(HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
typedef void (*HALCbRegisterSingleFunc)(HAL_NotifyCallback callback,
|
||||
void* param, HAL_Bool initialNotify);
|
||||
|
||||
// provider generates diffs based on values
|
||||
class HALSimWSHalProvider : public HALSimWSBaseProvider {
|
||||
|
||||
@@ -12,7 +12,7 @@ class HALSimWSProviderAddressableLED : public HALSimWSHalChanProvider {
|
||||
static void Initialize(WSRegisterFunc webRegisterFunc);
|
||||
|
||||
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
|
||||
~HALSimWSProviderAddressableLED();
|
||||
~HALSimWSProviderAddressableLED() override;
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
|
||||
@@ -21,7 +21,7 @@ class HALSimWSProviderAnalogIn : public HALSimWSHalChanProvider {
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
void CancelCallbacks() override;
|
||||
void CancelCallbacks() final;
|
||||
void DoCancelCallbacks();
|
||||
|
||||
private:
|
||||
@@ -45,7 +45,7 @@ class HALSimWSProviderAnalogOut : public HALSimWSHalChanProvider {
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
void CancelCallbacks() override;
|
||||
void CancelCallbacks() final;
|
||||
void DoCancelCallbacks();
|
||||
|
||||
private:
|
||||
|
||||
@@ -14,7 +14,7 @@ class HALSimWSProviderPCM : public HALSimWSHalChanProvider {
|
||||
static void Initialize(WSRegisterFunc webRegisterFunc);
|
||||
|
||||
using HALSimWSHalChanProvider::HALSimWSHalChanProvider;
|
||||
~HALSimWSProviderPCM();
|
||||
~HALSimWSProviderPCM() override;
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
|
||||
@@ -16,7 +16,7 @@ class HALSimWSProviderSolenoid : public HALSimWSHalProvider {
|
||||
explicit HALSimWSProviderSolenoid(int32_t pcmChannel, int32_t solenoidChannel,
|
||||
const std::string& key,
|
||||
const std::string& type);
|
||||
~HALSimWSProviderSolenoid();
|
||||
~HALSimWSProviderSolenoid() override;
|
||||
|
||||
protected:
|
||||
void RegisterCallbacks() override;
|
||||
|
||||
@@ -65,7 +65,7 @@ class CommandTestBase : public ::testing::Test {
|
||||
.WillRepeatedly(::testing::Return(m_requirements));
|
||||
}
|
||||
|
||||
MockCommand(const MockCommand& other) : Command{} {}
|
||||
MockCommand(const MockCommand& other) : Command{other} {}
|
||||
|
||||
void SetFinished(bool finished) {
|
||||
EXPECT_CALL(*this, IsFinished())
|
||||
|
||||
@@ -41,7 +41,7 @@ class BuiltInAccelerometer : public ErrorBase,
|
||||
* accelerometer will measure. Not all accelerometers support all
|
||||
* ranges.
|
||||
*/
|
||||
void SetRange(Range range) override;
|
||||
void SetRange(Range range) final;
|
||||
|
||||
/**
|
||||
* @return The acceleration of the roboRIO along the X axis in g-forces
|
||||
|
||||
@@ -382,7 +382,7 @@ class Counter : public ErrorBase,
|
||||
* @param maxPeriod The maximum period where the counted device is considered
|
||||
* moving in seconds.
|
||||
*/
|
||||
void SetMaxPeriod(double maxPeriod) override;
|
||||
void SetMaxPeriod(double maxPeriod) final;
|
||||
|
||||
/**
|
||||
* Select whether you want to continue updating the event timer output when
|
||||
|
||||
@@ -43,6 +43,7 @@ TEST(DifferentialDriveSim, Convergence) {
|
||||
auto trajectory = frc::TrajectoryGenerator::GenerateTrajectory(
|
||||
frc::Pose2d(), {}, frc::Pose2d(2_m, 2_m, 0_rad), config);
|
||||
|
||||
// NOLINTNEXTLINE
|
||||
for (double t = 0; t < trajectory.TotalTime().to<double>(); t += 0.02) {
|
||||
auto state = trajectory.Sample(20_ms);
|
||||
auto ramseteOut = ramsete.Calculate(sim.GetPose(), state);
|
||||
|
||||
@@ -106,7 +106,7 @@ target_link_libraries(wpimath wpiutil)
|
||||
|
||||
if (NOT USE_VCPKG_EIGEN)
|
||||
install(DIRECTORY src/main/native/eigeninclude/ DESTINATION "${include_dest}/wpimath")
|
||||
target_include_directories(wpimath PUBLIC
|
||||
target_include_directories(wpimath SYSTEM PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/eigeninclude>
|
||||
$<INSTALL_INTERFACE:${include_dest}/wpimath>)
|
||||
else()
|
||||
|
||||
@@ -117,7 +117,7 @@ Java_edu_wpi_first_math_WPIMathJNI_pow
|
||||
|
||||
Eigen::Map<
|
||||
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
|
||||
Amat{arrayBody, rows, rows};
|
||||
Amat{arrayBody, rows, rows}; // NOLINT
|
||||
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> Apow =
|
||||
Amat.pow(exponent);
|
||||
|
||||
@@ -146,7 +146,7 @@ Java_edu_wpi_first_math_WPIMathJNI_isStabilizable
|
||||
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
|
||||
B{nativeB, states, inputs};
|
||||
|
||||
bool isStabilizable = check_stabilizable(A, B);
|
||||
bool isStabilizable = check_stabilizable(A, B); // NOLINT
|
||||
|
||||
env->ReleaseDoubleArrayElements(aSrc, nativeA, 0);
|
||||
env->ReleaseDoubleArrayElements(bSrc, nativeB, 0);
|
||||
|
||||
@@ -47,7 +47,7 @@ ChassisSpeeds MecanumDriveKinematics::ToChassisSpeeds(
|
||||
Eigen::Vector3d chassisSpeedsVector =
|
||||
m_forwardKinematics.solve(wheelSpeedsMatrix);
|
||||
|
||||
return {units::meters_per_second_t{chassisSpeedsVector(0)},
|
||||
return {units::meters_per_second_t{chassisSpeedsVector(0)}, // NOLINT
|
||||
units::meters_per_second_t{chassisSpeedsVector(1)},
|
||||
units::radians_per_second_t{chassisSpeedsVector(2)}};
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class LinearPlantInversionFeedforward {
|
||||
*/
|
||||
Eigen::Matrix<double, Inputs, 1> Calculate(
|
||||
const Eigen::Matrix<double, States, 1>& nextR) {
|
||||
return Calculate(m_r, nextR);
|
||||
return Calculate(m_r, nextR); // NOLINT
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ static void CopyStream(uv::Stream& in, std::weak_ptr<uv::Stream> outWeak) {
|
||||
buf2.len = len;
|
||||
auto out = outWeak.lock();
|
||||
if (!out) {
|
||||
buf2.Deallocate();
|
||||
in.Close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ int SocketErrno();
|
||||
|
||||
std::string SocketStrerror(int code);
|
||||
|
||||
static inline std::string SocketStrerror() {
|
||||
inline std::string SocketStrerror() {
|
||||
return SocketStrerror(SocketErrno());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class TCPStream : public NetworkStream {
|
||||
size_t send(const char* buffer, size_t len, Error* err) override;
|
||||
size_t receive(char* buffer, size_t len, Error* err,
|
||||
int timeout = 0) override;
|
||||
void close() override;
|
||||
void close() final;
|
||||
|
||||
StringRef getPeerIP() const override;
|
||||
int getPeerPort() const override;
|
||||
|
||||
@@ -76,7 +76,7 @@ class WebSocket : public std::enable_shared_from_this<WebSocket> {
|
||||
ClientOptions() : handshakeTimeout{(uv::Timer::Time::max)()} {}
|
||||
|
||||
/** Timeout for the handshake request. */
|
||||
uv::Timer::Time handshakeTimeout;
|
||||
uv::Timer::Time handshakeTimeout; // NOLINT
|
||||
|
||||
/** Additional headers to include in handshake. */
|
||||
ArrayRef<std::pair<StringRef, StringRef>> extraHeaders;
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
#include "wpi/mutex.h"
|
||||
#include "wpi/raw_ostream.h"
|
||||
|
||||
/** WPILib C++ utilities (wpiutil) namespace */
|
||||
namespace wpi {
|
||||
|
||||
/** Java Native Interface (JNI) utility functions */
|
||||
namespace java {
|
||||
namespace wpi::java {
|
||||
|
||||
// Gets a Java stack trace. Also provides the last function
|
||||
// in the stack trace not starting with excludeFuncPrefix (useful for e.g.
|
||||
@@ -89,7 +86,7 @@ class JGlobal {
|
||||
|
||||
explicit operator bool() const { return m_cls; }
|
||||
|
||||
operator T() const { return m_cls; }
|
||||
operator T() const { return m_cls; } // NOLINT
|
||||
|
||||
protected:
|
||||
T m_cls = nullptr;
|
||||
@@ -117,7 +114,7 @@ class JLocal {
|
||||
m_env->DeleteLocalRef(m_obj);
|
||||
}
|
||||
}
|
||||
operator T() { return m_obj; }
|
||||
operator T() { return m_obj; } // NOLINT
|
||||
T obj() { return m_obj; }
|
||||
|
||||
private:
|
||||
@@ -151,7 +148,7 @@ class JStringRef {
|
||||
m_str.pop_back();
|
||||
}
|
||||
|
||||
operator StringRef() const { return m_str; }
|
||||
operator StringRef() const { return m_str; } // NOLINT
|
||||
StringRef str() const { return m_str; }
|
||||
const char* c_str() const { return m_str.data(); }
|
||||
size_t size() const { return m_str.size(); }
|
||||
@@ -187,7 +184,7 @@ class JArrayRefBase : public JArrayRefInner<JArrayRefBase<T>, T> {
|
||||
public:
|
||||
explicit operator bool() const { return this->m_elements != nullptr; }
|
||||
|
||||
operator ArrayRef<T>() const { return array(); }
|
||||
operator ArrayRef<T>() const { return array(); } // NOLINT
|
||||
|
||||
ArrayRef<T> array() const {
|
||||
if (!this->m_elements) {
|
||||
@@ -501,7 +498,7 @@ inline jobjectArray MakeJStringArray(JNIEnv* env, ArrayRef<std::string> arr) {
|
||||
template <typename T>
|
||||
class JCallbackThread : public SafeThread {
|
||||
public:
|
||||
void Main();
|
||||
void Main() override;
|
||||
|
||||
std::queue<T> m_queue;
|
||||
jobject m_func = nullptr;
|
||||
@@ -710,7 +707,6 @@ struct JExceptionInit {
|
||||
JException* cls;
|
||||
};
|
||||
|
||||
} // namespace java
|
||||
} // namespace wpi
|
||||
} // namespace wpi::java
|
||||
|
||||
#endif // WPIUTIL_WPI_JNI_UTIL_H_
|
||||
|
||||
@@ -155,7 +155,7 @@ class SimpleBufferPool {
|
||||
|
||||
private:
|
||||
SmallVector<Buffer, DEPTH> m_pool;
|
||||
size_t m_size;
|
||||
size_t m_size; // NOLINT
|
||||
};
|
||||
|
||||
} // namespace wpi::uv
|
||||
|
||||
@@ -20,6 +20,7 @@ TEST(ManagedStaticTest, LazyDoesNotInitialize) {
|
||||
{
|
||||
refCount = 0;
|
||||
wpi::ManagedStatic<StaticTestClass> managedStatic;
|
||||
(void)managedStatic;
|
||||
ASSERT_EQ(refCount, 0);
|
||||
}
|
||||
ASSERT_EQ(refCount, 0);
|
||||
@@ -43,7 +44,7 @@ TEST(ManagedStaticTest, EagerInit) {
|
||||
{
|
||||
refCount = 0;
|
||||
StaticTestClass* test = new StaticTestClass{};
|
||||
ASSERT_EQ(refCount, 1);
|
||||
ASSERT_EQ(refCount, 1); // NOLINT
|
||||
wpi::ManagedStatic<StaticTestClass> managedStatic(
|
||||
test, [](void* val) { delete static_cast<StaticTestClass*>(val); });
|
||||
ASSERT_EQ(refCount, 1);
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace wpi::uv {
|
||||
TEST(UvSimpleBufferPool, ConstructDefault) {
|
||||
SimpleBufferPool<> pool;
|
||||
auto buf1 = pool.Allocate();
|
||||
ASSERT_EQ(buf1.len, 4096u);
|
||||
ASSERT_EQ(buf1.len, 4096u); // NOLINT
|
||||
}
|
||||
|
||||
TEST(UvSimpleBufferPool, ConstructSize) {
|
||||
SimpleBufferPool<4> pool{8192};
|
||||
auto buf1 = pool.Allocate();
|
||||
ASSERT_EQ(buf1.len, 8192u);
|
||||
ASSERT_EQ(buf1.len, 8192u); // NOLINT
|
||||
}
|
||||
|
||||
TEST(UvSimpleBufferPool, ReleaseReuse) {
|
||||
|
||||
Reference in New Issue
Block a user