Skip to content

Commit

Permalink
Contiki-NG: Fix two compilation errors on macOS
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kkrentz authored and mrdeep1 committed Sep 14, 2023
1 parent 641d350 commit c41b747
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions coap_config.h.contiki
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@

#define WITH_CONTIKI 1

#define ntohs uip_ntohs

#define HASH_NONFATAL_OOM 1

#ifndef HEAPMEM_CONF_ARENA_SIZE
Expand Down
4 changes: 2 additions & 2 deletions src/coap_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion src/coap_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
Expand Down

0 comments on commit c41b747

Please sign in to comment.