Add missing compiler flags and fix warnings (#4889)

This makes the build fail on warnings. It caught two out-of-bounds reads
and a deprecation warning.
This commit is contained in:
Tyler Veness
2023-01-01 08:14:19 -08:00
committed by GitHub
parent 42fc4cb6bc
commit f0fa8205ac
9 changed files with 28 additions and 23 deletions

View File

@@ -125,8 +125,8 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status) {
// CS0 is not a DIO port, so nothing to allocate
handle = open("/dev/spidev0.0", O_RDWR);
if (handle < 0) {
fmt::print("Failed to open SPI port {}: {}\n", port,
std::strerror(errno));
fmt::print("Failed to open SPI port {}: {}\n",
static_cast<int32_t>(port), std::strerror(errno));
CommonSPIPortFree();
return;
}
@@ -147,8 +147,8 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status) {
}
handle = open("/dev/spidev0.1", O_RDWR);
if (handle < 0) {
fmt::print("Failed to open SPI port {}: {}\n", port,
std::strerror(errno));
fmt::print("Failed to open SPI port {}: {}\n",
static_cast<int32_t>(port), std::strerror(errno));
CommonSPIPortFree();
HAL_FreeDIOPort(digitalHandles[0]);
return;
@@ -170,8 +170,8 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status) {
}
handle = open("/dev/spidev0.2", O_RDWR);
if (handle < 0) {
fmt::print("Failed to open SPI port {}: {}\n", port,
std::strerror(errno));
fmt::print("Failed to open SPI port {}: {}\n",
static_cast<int32_t>(port), std::strerror(errno));
CommonSPIPortFree();
HAL_FreeDIOPort(digitalHandles[1]);
return;
@@ -193,8 +193,8 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status) {
}
handle = open("/dev/spidev0.3", O_RDWR);
if (handle < 0) {
fmt::print("Failed to open SPI port {}: {}\n", port,
std::strerror(errno));
fmt::print("Failed to open SPI port {}: {}\n",
static_cast<int32_t>(port), std::strerror(errno));
CommonSPIPortFree();
HAL_FreeDIOPort(digitalHandles[2]);
return;
@@ -240,8 +240,8 @@ void HAL_InitializeSPI(HAL_SPIPort port, int32_t* status) {
digitalSystem->readEnableMXPSpecialFunction(status) | 0x00F0, status);
handle = open("/dev/spidev1.0", O_RDWR);
if (handle < 0) {
fmt::print("Failed to open SPI port {}: {}\n", port,
std::strerror(errno));
fmt::print("Failed to open SPI port {}: {}\n",
static_cast<int32_t>(port), std::strerror(errno));
HAL_FreeDIOPort(digitalHandles[5]); // free the first port allocated
HAL_FreeDIOPort(digitalHandles[6]); // free the second port allocated
HAL_FreeDIOPort(digitalHandles[7]); // free the third port allocated