You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When including log_backend.h from a C++ application, the following error is produced by the C++ compiler:
zephyr/include/logging/log_backend.h:81:2: error: designator order for field 'log_backend_control_block::id' does not match declaration order in 'log_backend_control_block'
To Reproduce
Steps to reproduce the behavior:
Add the following code to a C++ source file
#include <logging/log_backend.h> const struct log_backend_api my_backend_api = {}; LOG_BACKEND_DEFINE(my_backend, my_backend_api, true); Expected behavior
A compilation error is not produced.
Impact
Annoyance. A workaround is to #undef the macro and redefine it with correct order of arguments.
Fix
The fix is to reverse the order of the .id and .active initialization lines in the LOG_BACKEND_DEFINE macro.
Environment (please complete the following information):
glenne
changed the title
Unable to LOG_BACKEND_DEFINE macro from log_backend.h using C++
Unable to use LOG_BACKEND_DEFINE macro from log_backend.h using C++
Feb 5, 2020
Describe the bug
When including log_backend.h from a C++ application, the following error is produced by the C++ compiler:
zephyr/include/logging/log_backend.h:81:2: error: designator order for field 'log_backend_control_block::id' does not match declaration order in 'log_backend_control_block'
To Reproduce
Steps to reproduce the behavior:
#include <logging/log_backend.h> const struct log_backend_api my_backend_api = {}; LOG_BACKEND_DEFINE(my_backend, my_backend_api, true);
Expected behavior
A compilation error is not produced.
Impact
Annoyance. A workaround is to #undef the macro and redefine it with correct order of arguments.
Fix
The fix is to reverse the order of the .id and .active initialization lines in the LOG_BACKEND_DEFINE macro.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: