fix(cl): avoid panicking on a BlockPointer member during union accessor generation
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
Start with genUnionAccessor and trace its calls through toType and toTypeEx, using the glob_t anonymous union and source/llcppg.cfg configuration as the reproduction. Run GOOS=darwin GOARCH=arm64 llcppg ./generated ./source with the macOS headers in source/darwin-arm64/include. Done means generation does not panic and clearly reports the unsupported Blocks callback without presenting the partially emitted record as complete or treating it as an ordinary C function pointer.
索引モデルが issue の本文から書いたものです。
説明
A Blocks callback member classified as unsupported/quietly ignored by toTypeEx becomes a hard panic when the same conversion is requested by a union accessor. The macOS glob_t header triggers this path.
Reproduction
Use a source Go module requiring github.com/goplus/lib v0.7.0, with this configuration in source/llcppg.cfg:
{
"Name": "libc",
"Language": "c",
"Dir": "$GOOS-$GOARCH/include",
"Files": [
"glob.h"
],
"FailFast": 0,
"IgnoreInline": true
}
Put the selected inputs under source/darwin-arm64/include, with the macOS 14.0 SDK headers available there where included. Leave Stdlib unset, and run:
GOOS=darwin GOARCH=arm64 llcppg ./generated ./source
The SDK's glob_t contains this anonymous union when __BLOCKS__ is defined by the selected target:
union {
int (*gl_errfunc)(const char *, int);
int (^gl_errblk)(const char *, int);
};
Actual result
Generation exits 2:
panic: unsupported type - int (^)(const char *, int)
The stack is genUnionAccessor -> toType -> toTypeEx. toTypeEx explicitly sets featQuietIgnore for Type_BlockPointer, but toType turns any ignore feature into a panic. genUnionAccessor uses this strict entry point without handling the unsupported member result.
Expected behavior
Handle this unsupported type deliberately and report its impact on the generated binding without panicking. Do not silently represent a Blocks callback as an ordinary C function pointer or claim that a partially emitted record is complete. Implementing full Blocks ABI support is a separate decision.
Merged #874 introduced the unsupported-type handling; it does not cover this union-accessor crash. This is also distinct from #1032's missing registration of named records.
Environment
Reproduced on macOS/arm64 with LLVM/libclang 22.1.8, LLGo 1.0.9 and github.com/goplus/lib v0.7.0. The relevant installed generator sources were checked byte-for-byte against current main 90bd72cf. SDK-dependent cases use macOS 14.0 headers. These are generation-stage results, not cross-platform or ABI certification.
- 主要言語
- Go
- スター
- 40
- フォーク
- 13
- 平均マージ
- 2時間 4分
- マージ済み PR(30日)
- 143
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
goplus/llcppg のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 6/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
goplus/llcppg#1136 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
cmd/ebitenmobile: multi-language bindings run the complete generator twice対応中かも @kumagi が今日担当しました。 オープンos:macos performance
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
hajimehoshi/ebiten#4011 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
agent-butler-finding chore
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
jordansmall/spindrift#6318 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Eyevinn/moqlivemock#166 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JakeChampion/lang#14091 ·
メンテナーはふだん 1 日以内に返信