Skip to content

[feat] 添加了一个优先级最高的自动导出#15

Merged
00lllooolll00 merged 1 commit into
masterfrom
develop/nn
Mar 30, 2026
Merged

[feat] 添加了一个优先级最高的自动导出#15
00lllooolll00 merged 1 commit into
masterfrom
develop/nn

Conversation

@00lllooolll00

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

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

EK_EXPORT_HARDWARE/COMPONENTS/APP/USER 的优先级值整体 +1(硬件从 0 变成 1 等),会改变启用 EK_EXPORT 时的初始化调用顺序;如果已有代码依赖旧的宏优先级,这会造成行为变化。建议至少在头文件中明确说明该优先级映射已变更,或提供兼容旧映射的别名宏以避免静默破坏。

Copilot uses AI. Check for mistakes.
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)

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

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

这些 EK_EXPORT_* 便捷宏会把 fn 传入 EK_EXPORT,而 EK_EXPORT 会在符号名里做 __init_##fn##prio 的 token-paste;因此 fn 实际上必须是“函数名标识符”,不能是任意函数指针表达式(例如 &fn、强转、括号包裹的表达式等),否则会触发预处理/编译错误。建议在这些宏附近补充注释/文档,明确 fn 的用法约束。

Copilot uses AI. Check for mistakes.
@00lllooolll00 00lllooolll00 merged commit 24b987c into master Mar 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants