-
Notifications
You must be signed in to change notification settings - Fork 321
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
common.h: Guard definition of IS_ALIGNED for Zephyr builds #8708
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,14 @@ | |
/* callers must check/use the return value */ | ||
#define __must_check __attribute__((warn_unused_result)) | ||
|
||
#ifdef __ZEPHYR__ | ||
#include <zephyr/sys/util.h> | ||
#endif | ||
|
||
/* Align the number to the nearest alignment value */ | ||
#ifndef IS_ALIGNED | ||
#define IS_ALIGNED(size, alignment) ((size) % (alignment) == 0) | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is referring to zephyrproject-rtos/zephyr#67243 which isn't merged yet, right? So if we merge this first this will break Zephyr builds? This cannot be merged like this. A simple solution would be to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Long term we move this and other common Zephyr re-definitions to the xtos header directory for remaining xtos users and pull this directly from Zephyr. |
||
|
||
/* Treat zero as a special case because it wraps around */ | ||
#define is_power_of_2(x) ((x) && !((x) & ((x) - 1))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for "extreme" cases,
#ifndef
is always best avoided because it makes the usual, horrible macro experience even worse. Zephyr forbids it: https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html#rule-a-3-macro-name-collisionsAs requested in zephyrproject-rtos/zephyr#67243 (comment), please rename this
SOF_ALIGN()
and make everything simpler: backwards and forwards compatibility and trannsitionsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marc-hb Can you do a follow-up on SOF side. This is sufficient for now to unblock the integration of Zephyr side IS_ALIGNED. SOF can move to other naming on its own pace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submitted in #8755