apache / apache/mynewt-core

MyNewt core does not compile (warnings, errors) if NDEBUG is defined

Open
#2,128 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
891
Forks
381
Avg merge
2d 7h
Merged PRs (30d)
14

Description

If mynewt is compiled with -DNDEBUG, multiple files have errors or warnings. These are mostly simple cases of unused variables used by assert() (which is a void statement in the NDEBUG case).

hw/bus/src/bus.c : bus_node_unlock() - unused variable 'err'
hw/hal/src/hal_flash.c : hal_flash_erase() - unused variable 'rc'
hw/mcu/stm/stm32_common/src/hal_gpio.c : MYNEWT_VAL macro undefined (as does not include mynewt.h explicitly)
hw/mcu/stm/stm32_common/src/hal_uart.c : MYNEWT_VAL macro undefined for same reason
hw/mcu/stm/stm32_common/src/hal_spi.c :
stm32_resolve_spi_irq() : no value returned (as falls thru default case)
stm32_resolve_spi_irq_handler() : no value returned (as falls thru default case)
kernel/os/src/os.c : unused variables 'rc' or 'err' in os_init_idle_task()/os_init()/os_start()/os_pkg_init()
kernel/os/src/os_heap.c : unused variable 'rc' in os_malloc_lock()/os_malloc_unlock()
kernel/os/src/os_sched.c : unused variable 'top' in os_sched_ctx_sw_hook()

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by compiling mynewt-core with -DNDEBUG and review the diagnostics in the listed files, beginning with hw/bus/src/bus.c and hw/hal/src/hal_flash.c. Then inspect the MYNEWT_VAL uses in the STM32 files, the SPI IRQ return paths, and the unused variables in kernel/os/src. Done means the affected files compile without warnings or errors when NDEBUG is defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.