From 674fca2023219beec5ede3eaef0e0c7c9697eb7e Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 25 Nov 2021 09:46:45 +0100 Subject: [PATCH] sys/arduino: use static_assert() instead of BUILD_BUG_ON() --- sys/arduino/SPI.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arduino/SPI.cpp b/sys/arduino/SPI.cpp index fd67aa83cb..d4f263c060 100644 --- a/sys/arduino/SPI.cpp +++ b/sys/arduino/SPI.cpp @@ -66,8 +66,10 @@ SPISettings::SPISettings(uint32_t clock_hz, uint8_t bitOrder, uint8_t dataMode) SPIClass::SPIClass(spi_t spi_dev) { - /* Check if default SPI interface is valid */ - BUILD_BUG_ON(ARDUINO_SPI_INTERFACE >= SPI_NUMOF); + /* Check if default SPI interface is valid. Casting to int to avoid + * bogus type-limits warning here. */ + static_assert((int)ARDUINO_SPI_INTERFACE <= (int)SPI_NUMOF, + "spi_dev out of bounds"); this->spi_dev = spi_dev; this->settings = SPISettings(); this->is_transaction = false;