From 836ceec4365a8cb41a805eb851f73ab7211bcf1b Mon Sep 17 00:00:00 2001 From: kkrentz Date: Thu, 14 Sep 2023 09:17:27 +0200 Subject: [PATCH] Contiki-NG: Fix two compilation errors on macOS One compilation error was a redefinition of ntohs in coap_config.h.contiki. Another compilation error was due to an unused function in coap_time.c. --- .github/workflows/main.yml | 17 +++++++++++++++++ coap_config.h.contiki | 2 -- src/coap_debug.c | 4 ++-- src/coap_time.c | 7 ++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46baa0e4..e9cb01d1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -112,6 +112,23 @@ jobs: run: | cd build_test cmake --build . + contiki-build-macos: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: install macOS software + run: | + brew install make automake + - name: setup + run: | + ./autogen.sh + - name: configure + run: | + ./configure --disable-doxygen --disable-manpages --disable-dtls --without-epoll --disable-examples --disable-examples-source --disable-tcp --disable-oscore --disable-q-block + - name: compile + run: | + gmake -C examples/contiki other-build: runs-on: ubuntu-latest strategy: diff --git a/coap_config.h.contiki b/coap_config.h.contiki index b224a88f..6a1677ea 100644 --- a/coap_config.h.contiki +++ b/coap_config.h.contiki @@ -96,8 +96,6 @@ #define WITH_CONTIKI 1 -#define ntohs uip_ntohs - #define HASH_NONFATAL_OOM 1 #ifndef HEAPMEM_CONF_ARENA_SIZE diff --git a/src/coap_debug.c b/src/coap_debug.c index d2856c06..51248fdd 100644 --- a/src/coap_debug.c +++ b/src/coap_debug.c @@ -228,14 +228,14 @@ coap_print_addr(const coap_address_t *addr, unsigned char *buf, size_t len) { case AF_INET: snprintf((char *)buf, len, "%s:%d", coap_print_ip_addr(addr, scratch, sizeof(scratch)), - ntohs(addr->addr.sin.sin_port)); + coap_address_get_port(addr)); break; #endif /* COAP_IPV4_SUPPORT */ #if COAP_IPV6_SUPPORT case AF_INET6: snprintf((char *)buf, len, "[%s]:%d", coap_print_ip_addr(addr, scratch, sizeof(scratch)), - ntohs(addr->addr.sin6.sin6_port)); + coap_address_get_port(addr)); break; #endif /* COAP_IPV6_SUPPORT */ #if COAP_AF_UNIX_SUPPORT diff --git a/src/coap_time.c b/src/coap_time.c index f84a044c..cfeecb1f 100644 --- a/src/coap_time.c +++ b/src/coap_time.c @@ -134,7 +134,12 @@ coap_ticks_from_rt_us(uint64_t t) { #else /* HAVE_TIME_H */ -/* make compilers happy that do not like empty modules */ +#ifdef __clang__ +/* Make compilers happy that do not like empty modules. As this function is + * never used, we ignore -Wunused-function at the end of compiling this file + */ +#pragma GCC diagnostic ignored "-Wunused-function" +#endif COAP_STATIC_INLINE void dummy(void) { }