-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Labels
area: LoggingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Description
Describe the bug
I'm getting a compiler warning when using CONFIG_LOG_BACKEND_MQTT=y
:
<ws-path>/zephyr/subsys/logging/backends/log_backend_mqtt.c:112:20: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
Steps to reproduce
- create a basic project
- CMakeLists.txt:
cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(log_mqtt_warning) FILE(GLOB app_sources src/*.c) target_sources(app PRIVATE ${app_sources})
- main.c:
int main() { return 0; }
- Add these configs to
prj.conf
:
CONFIG_LOG=y
CONFIG_NETWORKING=y
CONFIG_MQTT_LIB=y
CONFIG_LOG_BACKEND_MQTT=y
west build -b nucleo_f429zi
Expected behaviour
Build suceeds without any warnings.
Impact
Annoying but not much more but can be a problem if you're trying to build with CONFIG_COMPILER_OPT="-Wall -Werror"
.
Relevant log output
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- CMake version: 3.28.1
-- Zephyr version: 4.2.0-rc2 (<ws-path>/zephyr)
-- Found west (found suitable version "1.4.0", minimum required is "0.14.0")
-- Board: nucleo_f429zi, qualifiers: stm32f429xx
-- Found host-tools: zephyr 0.17.1 (/home/<user>/zephyr-sdk-0.17.1)
-- Found toolchain: zephyr 0.17.1 (/home/<user>/zephyr-sdk-0.17.1)
-- Found GnuLd: /home/<user>/zephyr-sdk-0.17.1/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd (found version "2.38")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/<user>/zephyr-sdk-0.17.1/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
-- Zephyr version: 4.2.0-rc2 (<ws-path>/zephyr), build: v4.2.0-rc2-69-g7a8bd3dbe752
[53/212] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/backends/log_backend_mqtt.c.obj
<ws-path>/zephyr/subsys/logging/backends/log_backend_mqtt.c: In function 'log_backend_mqtt_topic_set':
<ws-path>/zephyr/subsys/logging/backends/log_backend_mqtt.c:112:20: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
112 | mqtt_topic = topic;
| ^
[212/212] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 87576 B 2 MB 4.18%
RAM: 42656 B 192 KB 21.70%
CCM: 0 GB 64 KB 0.00%
IDT_LIST: 0 GB 32 KB 0.00%
Generating files from <ws-path>/zephyr/dev/log_mqtt_error/build/zephyr/zephyr.elf for board: nucleo_f429zi
Impact
Annoyance – Minor irritation; no significant impact on usability or functionality.
Environment
- Debian GNU/Linux 12
- Zephyr SDK 0.17.1
- Zephyr OS build v4.2.0-rc2-69-g7a8bd3dbe752
Additional Context
No response
Metadata
Metadata
Assignees
Labels
area: LoggingbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug