Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging: Add compile time error on 64 bit platforms #11110

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/logging/log_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
extern "C" {
#endif

#if UINTPTR_MAX == 0xFFFFFFFFFFFFFFFFUL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have BUILD_ASSERT_MSG() macro that could be used here, so something like this

BUILD_ASSERT_MSG(sizeof(void *) == 4, "Logger does not support 64 bit architecture");

You seem to be using it already in log_msg.h. I have no preference for this so this proposal is ok too.

#error "Logger does not support 64 bit architecture."
#endif

#if !CONFIG_LOG
#define CONFIG_LOG_DEFAULT_LEVEL 0
#define CONFIG_LOG_DOMAIN_ID 0
Expand Down