feat: 标准库子集在零 libc 档上可用 —— 94/103 个头 - #231
Merged
Merged
Conversation
* std-freestanding-nolibc 0.2.0 —— 五个函数 + **四份 C 头** * std-freestanding 0.4.0 —— nolibc feature ⭐ 障碍从来不是「子集想要 C 库」:libc++ 为 C 头带了包装头,靠 #include_next 到真正 那份去取 size_t / mbstate_t / time_t / EOF。没有 C 库时这条链无处可续,而包装头报的是 **缺类型**不是缺头 —— 所以从错误信息里看不出原因。⚠️ 顺序是整个机制:shim 目录必须排在 libc++ **之后**。实测:放前面解锁 0 个, 放后面解锁 79 个。 九个真需要 C 库的头(cinttypes/cmath/complex/cstdlib/exception/format/print/random/ valarray)由 feature 宏摘掉,连同各自的导出表。 验证:零 libc 工程用 std::array + std::ranges::sort(带比较器)+ std::string_view, qemu 中打印 54321 / zero-libc std ok,11156 字节,底下没有任何 C 库。
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.
⭐ 障碍从来不是「子集想要 C 库」:libc++ 为 C 头带了包装头,靠 #include_next 到真正
那份去取 size_t / mbstate_t / time_t / EOF。没有 C 库时这条链无处可续,而包装头报的是
缺类型不是缺头 —— 所以从错误信息里看不出原因。
放后面解锁 79 个。
九个真需要 C 库的头(cinttypes/cmath/complex/cstdlib/exception/format/print/random/
valarray)由 feature 宏摘掉,连同各自的导出表。
验证:零 libc 工程用 std::array + std::ranges::sort(带比较器)+ std::string_view,
qemu 中打印 54321 / zero-libc std ok,11156 字节,底下没有任何 C 库。