Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

fix(tool,cl): msgpack-c recursive discovery ends in duplicate atomic counter type

未关闭
#997 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
c, go
领域
compilers

调研方向

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 内容生成。

描述

bug

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, commit e17beb371b59459a13b48e166a11e123bda5bf93. The Formula floor is c-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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

goplus/llcppg 的其他 Issue

查看 goplus/llcppg 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。