From b4a5df49e64c5f13333f5251619d71235a60be38 Mon Sep 17 00:00:00 2001 From: Moandor Date: Tue, 12 May 2020 07:45:38 +0800 Subject: [PATCH] [continuous-integration] enable most features on build check (#4946) --- .github/workflows/build.yml | 13 +++++++++++ include/openthread/platform/toolchain.h | 8 +++++++ script/check-posix-build-cmake | 30 +++++++++++++++++++++++++ src/posix/platform/netif.cpp | 4 ++-- src/posix/platform/udp.cpp | 13 ++++++----- 5 files changed, 60 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6e25fb82..02b2338d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,20 @@ jobs: script/make-pretty check package: + name: package-${{ matrix.compiler }} runs-on: ubuntu-18.04 + strategy: + matrix: + include: + - compiler: gcc + compiler_c: gcc + compiler_cpp: g++ + - compiler: clang + compiler_c: clang + compiler_cpp: clang++ + env: + CC: ${{ matrix.compiler_c }} + CXX: ${{ matrix.compiler_cpp }} steps: - uses: actions/checkout@v2 - name: Bootstrap diff --git a/include/openthread/platform/toolchain.h b/include/openthread/platform/toolchain.h index bcd24f058..c1f3a003c 100644 --- a/include/openthread/platform/toolchain.h +++ b/include/openthread/platform/toolchain.h @@ -249,6 +249,14 @@ extern "C" { #endif #endif +#ifdef __APPLE__ +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wgnu-folding-constant\"") \ + __VA_ARGS__ _Pragma("GCC diagnostic pop") +#else +#define OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(...) __VA_ARGS__ +#endif + /** * @} * diff --git a/script/check-posix-build-cmake b/script/check-posix-build-cmake index 2e99267a7..c025713e8 100755 --- a/script/check-posix-build-cmake +++ b/script/check-posix-build-cmake @@ -45,6 +45,36 @@ build() options+=( "-DOT_COMPILE_WARNING_AS_ERROR=on" "-DOT_PLATFORM=posix" + "-DOT_BORDER_AGENT=on" + "-DOT_BORDER_ROUTER=on" + "-DOT_CHANNEL_MANAGER=on" + "-DOT_CHANNEL_MONITOR=on" + "-DOT_CHILD_SUPERVISION=on" + "-DOT_COAP=on" + "-DOT_COAPS=on" + "-DOT_COMMISSIONER=on" + "-DOT_DHCP6_CLIENT=on" + "-DOT_DHCP6_SERVER=on" + "-DOT_DIAGNOSTIC=on" + "-DOT_DNS_CLIENT=on" + "-DOT_ECDSA=on" + "-DOT_EXTERNAL_HEAP=on" + "-DOT_IP6_FRAGM=on" + "-DOT_JAM_DETECTION=on" + "-DOT_JOINER=on" + "-DOT_LEGACY=on" + "-DOT_LINK_RAW=on" + "-DOT_LOG_LEVEL_DYNAMIC=on" + "-DOT_MAC_FILTER=on" + "-DOT_MTD_NETDIAG=on" + "-DOT_PLATFORM_NETIF=on" + "-DOT_PLATFORM_UDP=on" + "-DOT_REFERENCE_DEVICE=on" + "-DOT_SERVICE=on" + "-DOT_SETTINGS_RAM=on" + "-DOT_SLAAC=on" + "-DOT_SNTP_CLIENT=on" + "-DOT_FULL_LOGS=on" ) mkdir -p $OT_BUILDDIR diff --git a/src/posix/platform/netif.cpp b/src/posix/platform/netif.cpp index c75f4af2b..a9031c029 100644 --- a/src/posix/platform/netif.cpp +++ b/src/posix/platform/netif.cpp @@ -963,7 +963,7 @@ static void processNetifEvent(otInstance *aInstance) VerifyOrExit(length > 0, OT_NOOP); #if defined(__linux__) - for (struct nlmsghdr *msg = reinterpret_cast(buffer); NLMSG_OK(msg, length); + for (struct nlmsghdr *msg = reinterpret_cast(buffer); NLMSG_OK(msg, static_cast(length)); msg = NLMSG_NEXT(msg, length)) { #else @@ -1363,7 +1363,7 @@ void platformNetifInit(otInstance *aInstance, const char *aInterfaceName) otIcmp6SetEchoMode(aInstance, OT_ICMP6_ECHO_HANDLER_DISABLED); otIp6SetReceiveCallback(aInstance, processReceive, aInstance); otIp6SetAddressCallback(aInstance, processAddressChange, aInstance); - otSetStateChangedCallback(aInstance, processStateChange, aInstance); + SuccessOrDie(otSetStateChangedCallback(aInstance, processStateChange, aInstance)); #if OPENTHREAD_POSIX_MULTICAST_PROMISCUOUS_REQUIRED otIp6SetMulticastPromiscuousEnabled(aInstance, true); #endif diff --git a/src/posix/platform/udp.cpp b/src/posix/platform/udp.cpp index ae2ee8cd8..9e78c9c54 100644 --- a/src/posix/platform/udp.cpp +++ b/src/posix/platform/udp.cpp @@ -82,12 +82,13 @@ static bool IsMulticast(const struct in6_addr &aAddress) static otError transmitPacket(int aFd, uint8_t *aPayload, uint16_t aLength, const otMessageInfo &aMessageInfo) { struct sockaddr_in6 peerAddr; - uint8_t control[CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int))]; - size_t controlLength = 0; - struct iovec iov; - struct msghdr msg; - struct cmsghdr * cmsg; - ssize_t rval; + uint8_t + control[OT_APPLE_IGNORE_GNU_FOLDING_CONSTANT(CMSG_SPACE(sizeof(struct in6_pktinfo)) + CMSG_SPACE(sizeof(int)))]; + size_t controlLength = 0; + struct iovec iov; + struct msghdr msg; + struct cmsghdr *cmsg; + ssize_t rval; memset(&peerAddr, 0, sizeof(peerAddr)); peerAddr.sin6_port = htons(aMessageInfo.mPeerPort);