diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e80ec210e..9c7e023a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,12 +153,32 @@ jobs: script/check-simulation-build script/check-posix-build + clang: + name: clang-${{ matrix.clang_ver }} + runs-on: ubuntu-18.04 + strategy: + matrix: + clang_ver: ["6.0", "7", "8", "9"] + env: + CC: clang-${{ matrix.clang_ver }} + CXX: clang++-${{ matrix.clang_ver }} + steps: + - uses: actions/checkout@v2 + - name: Bootstrap + run: | + sudo apt-get update + sudo apt-get --no-install-recommends install -y clang-${{ matrix.clang_ver }} clang++-${{ matrix.clang_ver }} ninja-build libreadline-dev libncurses-dev + - name: Build + run: | + script/check-simulation-build + script/check-posix-build + clang-m32: name: clang-m32-${{ matrix.clang_ver }} runs-on: ubuntu-18.04 strategy: matrix: - clang_ver: [9] + clang_ver: ["6.0", "7", "8", "9"] env: CC: clang-${{ matrix.clang_ver }} CXX: clang++-${{ matrix.clang_ver }} @@ -175,6 +195,7 @@ jobs: sudo apt-get --no-install-recommends install -y libreadline-dev:i386 libncurses-dev:i386 - name: Build run: | + script/check-simulation-build script/check-posix-build gn: diff --git a/script/check-simulation-build-autotools b/script/check-simulation-build-autotools index 84a1439f8..ed6811113 100755 --- a/script/check-simulation-build-autotools +++ b/script/check-simulation-build-autotools @@ -72,6 +72,7 @@ build_all_features() "-DOPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE=1" "-DOPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE=1" "-DOPENTHREAD_CONFIG_MPL_DYNAMIC_INTERVAL_ENABLE" + "-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1" "-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1" "-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1" "-DOPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE=1" diff --git a/src/core/common/debug.hpp b/src/core/common/debug.hpp index ba15fde76..50dd2b2b2 100644 --- a/src/core/common/debug.hpp +++ b/src/core/common/debug.hpp @@ -71,7 +71,7 @@ } \ } while (0) -#else +#else // OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT #define OT_ASSERT(cond) \ do \ @@ -86,7 +86,7 @@ #endif // OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT -#else +#else // OPENTHREAD_CONFIG_ASSERT_ENABLE #define OT_ASSERT(cond) diff --git a/src/ncp/ncp_spi.cpp b/src/ncp/ncp_spi.cpp index b8a931b02..f4dc788c1 100644 --- a/src/ncp/ncp_spi.cpp +++ b/src/ncp/ncp_spi.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include "openthread-core-config.h" #include "common/code_utils.hpp" @@ -81,7 +82,7 @@ NcpSpi::NcpSpi(Instance *aInstance) , mTxState(kTxStateIdle) , mHandlingRxFrame(false) , mResetFlag(true) - , mPrepareTxFrameTask(*aInstance, &NcpSpi::PrepareTxFrame, this) + , mPrepareTxFrameTask(*aInstance, NcpSpi::PrepareTxFrame, this) , mSendFrameLength(0) { SpiFrame sendFrame(mSendFrame); @@ -102,14 +103,15 @@ NcpSpi::NcpSpi(Instance *aInstance) mTxFrameBuffer.SetFrameAddedCallback(HandleFrameAddedToTxBuffer, this); - otPlatSpiSlaveEnable(&NcpSpi::SpiTransactionComplete, &NcpSpi::SpiTransactionProcess, this); + IgnoreError(otPlatSpiSlaveEnable(&NcpSpi::SpiTransactionComplete, &NcpSpi::SpiTransactionProcess, this)); // We signal an interrupt on this first transaction to // make sure that the host processor knows that our // reset flag was set. - otPlatSpiSlavePrepareTransaction(mEmptySendFrameZeroAccept, kSpiHeaderSize, mEmptyReceiveFrame, kSpiHeaderSize, - /* aRequestTransactionFlag */ true); + IgnoreError(otPlatSpiSlavePrepareTransaction(mEmptySendFrameZeroAccept, kSpiHeaderSize, mEmptyReceiveFrame, + kSpiHeaderSize, + /* aRequestTransactionFlag */ true)); } bool NcpSpi::SpiTransactionComplete(void * aContext, @@ -217,7 +219,8 @@ exit: sendFrame.SetHeaderAcceptLen(aInputLen - kSpiHeaderSize); - otPlatSpiSlavePrepareTransaction(aOutputBuf, aOutputLen, aInputBuf, aInputLen, (mTxState == kTxStateSending)); + IgnoreError( + otPlatSpiSlavePrepareTransaction(aOutputBuf, aOutputLen, aInputBuf, aInputLen, (mTxState == kTxStateSending))); return shouldProcess; } @@ -278,6 +281,9 @@ void NcpSpi::PrepareNextSpiSendFrame(void) readLength = mTxFrameBuffer.OutFrameRead(frameLength, sendFrame.GetData()); OT_ASSERT(readLength == frameLength); + // Suppress the warning when assertions are disabled + OT_UNUSED_VARIABLE(readLength); + sendFrame.SetHeaderDataLen(frameLength); mSendFrameLength = frameLength + kSpiHeaderSize; @@ -302,7 +308,7 @@ void NcpSpi::PrepareNextSpiSendFrame(void) ExitNow(); } - mTxFrameBuffer.OutFrameRemove(); + IgnoreError(mTxFrameBuffer.OutFrameRemove()); exit: return; @@ -367,8 +373,9 @@ void NcpSpi::HandleRxFrame(void) { sendFrame.SetHeaderAcceptLen(kSpiBufferSize - kSpiHeaderSize); - otPlatSpiSlavePrepareTransaction(mEmptySendFrameFullAccept, kSpiHeaderSize, mReceiveFrame, kSpiBufferSize, - /* aRequestTrans */ false); + IgnoreError(otPlatSpiSlavePrepareTransaction(mEmptySendFrameFullAccept, kSpiHeaderSize, mReceiveFrame, + kSpiBufferSize, + /* aRequestTrans */ false)); // No need to check the error status. Getting `OT_ERROR_BUSY` // is OK as everything will be set up properly from callback when