-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
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: highHigh impact/importance bugHigh impact/importance bug
Description
Describe the bug
If -Wextra is enabled on an application using the logging subsystem a few compilers warnings related to signed/unsigned comparisons are reported
To Reproduce
Steps to reproduce the behavior:
- Take any application that makes uses of the logging subsystem, e.g.
LOG_ERR(...). - Enable
-Wextra,target_compile_options(app PRIVATE -Wextra) - Observe reported warnings
Expected behavior
I expect that logging subsystem makes consistent usage of signed/unsigned integers
Impact
-Wextra may be useful in applications that want to enforce stricter rules (e.g. MISRA)
Logs and console output
zephyr/include/logging/log_msg2.h:297:39: warning: operand of ?: changes signedness from 'int' to 'unsigned int' due to unsignedness of other operand [-Wsign-compare]
297 | CBPRINTF_STATIC_PACKAGE(_msg->data, _plen, _plen, \
zephyr/include/sys/cbprintf_internal.h:230:19: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
230 | if (_buf && _idx < _max) { \
zephyr/include/sys/cbprintf_internal.h:320:22: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'unsigned int'} [-Wsign-compare]
320 | _outlen = (_pkg_len > _pmax) ? -ENOSPC : _pkg_len; \
Environment (please complete the following information):
- OS: Linux
- Toolchain Zephyr SDK 0.12.4
- Commit SHA or Version used 5d29096
Additional context
Add any other context about the problem here.
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: highHigh impact/importance bugHigh impact/importance bug