fix(tool,cl): msgpack-c recursive discovery ends in duplicate atomic counter type
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with tool/gen.go, where TopHeaders runs recursive discovery when Files is absent, then tool/pputil/pputil.go for the include-based top-header selection. The collision involves msgpack's unpack_template.h, which needs caller-provided macros, and the duplicate X_atomicCounterT typedef from gcc_atomic.h and sysdep.h; the typedef path runs through loadTypedef and defineTypedef. Done means generation over the installed msgpack-c headers either discovers the public API without the panic or fails with a precise unsupported-input diagnostic, and the design choice needs maintainer input first.
由索引模型根据 Issue 内容生成。
描述
Observed failure
With recursive installed-header discovery and no Files allowlist, msgpack-c generation emits preprocessing diagnostics for unpack_template.h, then panics on a duplicate generated type X_atomicCounterT.
msgpack/unpack_template.h: ... msgpack_unpack_func template is not defined
msgpack/unpack_template.h: ... msgpack_unpack_callback template is not defined
msgpack/unpack_template.h: ... msgpack_unpack_struct template is not defined
panic: .../msgpack/gcc_atomic.h:14:1: X_atomicCounterT redeclared in this block
previous declaration at .../msgpack/sysdep.h:84:5
The ordering above is observed in the log; it is not a claim that the template diagnostics have been proven to cause the type collision.
Confirmed jobs: Linux arm64 and macOS amd64. Both pass the Formula test, installed-input preparation, LLGo build, and llcppg build, then fail during Test llcppg generation with exit code 2. The other two platform jobs were pending when evidence was collected.
Versions and reproduction input
- llcppg:
8fc0f987e41ffe4b4f608e9541422b460ea89fea. - LLGo:
afe9a5407260348b18c7104e98d76cb5cdf48b29; LLVM 21. - Actual installed source: msgpack/msgpack-c
c-7.0.2, commite17beb371b59459a13b48e166a11e123bda5bf93. The Formula floor isc-6.1.0, but that is not the version used by these CI jobs. - Failed index head:
249c1573839532d54ca139e7de5dd03a375e8f39, index PR #34.
{
"Name": "msgpack",
"Language": "c",
"Dir": "./include/...",
"LLGoPackage": "link: $(pkg-config --libs msgpack-c)",
"FuncPrefix": ["msgpack_"],
"TypePrefix": ["msgpack_"]
}
The workflow stages the entire installed include tree under source/include, initializes the source Go module, and runs llcppg -v ./generated ./source. It does not restrict generation to the umbrella header.
Source evidence and expected behavior
unpack_template.h, lines 11–32, explicitly requires caller-provided template macros. include/msgpack/gcc_atomic.h:14 declares typedef int _msgpack_atomic_counter_t;; the installed sysdep.h:84 comes from cmake/sysdep.h.in:84, which declares typedef unsigned int _msgpack_atomic_counter_t; in its alternative branch.
The installed public API should be discoverable without treating context-dependent template/alternative implementation headers as unrelated translation units that collide, or the tool should report a precise unsupported-input diagnostic instead of panicking. The correct discovery/type-handling change still needs investigation; excluding public APIs is not proposed as the fix.
Main at aab6dbf0baedc47b42f9576a65dd79ce6715e31a was checked read-only: tool/gen.go still calls TopHeaders for recursive discovery when Files is absent; tool/pputil/pputil.go performs the include-based top-header selection; typedefs reach loadTypedef/defineTypedef. No latest-main runtime reproduction is claimed.
- 主要语言
- Go
- 星标
- 41
- 派生
- 13
- 平均合并
- 2 小时 10 分钟
- 30 天内合并 PR
- 193
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
goplus/llcppg 的其他 Issue
-
Proposal: `Define` — inject constants into the generated package可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭configuration feature proposal
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
bug
难度 5/5 一周以上 新手友好度 28/100
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
feature proposal
难度 5/5 一周以上 新手友好度 18/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area/frontend/library-panels automated-triage type/bug type/ux
难度 1/5 1 小时以内 新手友好度 78/100
维护者通常 1 天内回复
-
bug raised-by:verifier
难度 2/5 1-3 小时 新手友好度 75/100
medici-finance/assay#4554 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 67/100
microsoft/azure-linux-image-tools#954 ·
维护者通常 1 天内回复
-
help wanted
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复