[feat] 添加了一个优先级最高的自动导出#15
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 在 L2 Core 的函数自动导出/初始化机制中新增了一个“最早执行”的导出优先级入口,用于让特定初始化逻辑在现有硬件/组件等初始化之前执行。
Changes:
- 新增
EK_EXPORT_EARLIEST(fn)作为最高优先级的导出宏 - 调整
EK_EXPORT_HARDWARE/COMPONENTS/APP/USER的内置优先级映射(整体后移) - 在启用导出时,便捷宏调用形式改为
EK_EXPORT(fn, N)(不再包裹(fn))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+61
to
+65
| # define EK_EXPORT_EARLIEST(fn) EK_EXPORT(fn, 0) | ||
| # define EK_EXPORT_HARDWARE(fn) EK_EXPORT(fn, 1) | ||
| # define EK_EXPORT_COMPONENTS(fn) EK_EXPORT(fn, 2) | ||
| # define EK_EXPORT_APP(fn) EK_EXPORT(fn, 3) | ||
| # define EK_EXPORT_USER(fn) EK_EXPORT(fn, 4) |
There was a problem hiding this comment.
EK_EXPORT_HARDWARE/COMPONENTS/APP/USER 的优先级值整体 +1(硬件从 0 变成 1 等),会改变启用 EK_EXPORT 时的初始化调用顺序;如果已有代码依赖旧的宏优先级,这会造成行为变化。建议至少在头文件中明确说明该优先级映射已变更,或提供兼容旧映射的别名宏以避免静默破坏。
Comment on lines
+61
to
+63
| # define EK_EXPORT_EARLIEST(fn) EK_EXPORT(fn, 0) | ||
| # define EK_EXPORT_HARDWARE(fn) EK_EXPORT(fn, 1) | ||
| # define EK_EXPORT_COMPONENTS(fn) EK_EXPORT(fn, 2) |
There was a problem hiding this comment.
这些 EK_EXPORT_* 便捷宏会把 fn 传入 EK_EXPORT,而 EK_EXPORT 会在符号名里做 __init_##fn##prio 的 token-paste;因此 fn 实际上必须是“函数名标识符”,不能是任意函数指针表达式(例如 &fn、强转、括号包裹的表达式等),否则会触发预处理/编译错误。建议在这些宏附近补充注释/文档,明确 fn 的用法约束。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.