fix(cl): preserve null callback arguments in automatically detected forwarding macros
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
Start in cl/macrofunc.go at doCompileAutoMacroFunc, where detected macro arguments reach cb.Val(arg.v), and inspect the fropen/fwopen declarations from the configured macOS headers. Reproduce with GOOS=darwin GOARCH=arm64 llcppg ./generated ./source. Done means automatic generation preserves the null callback arguments or rejects the unsupported macro shape cleanly, without generating an invalid call or panicking; add a focused regression case for this macro form.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Automatic forwarding-macro generation panics on macOS fropen, which passes integer zero as three null callback arguments to funopen.
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": [
"stdio.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 relevant SDK declarations are:
FILE *funopen(const void *,
int (*)(void *, char *, int),
int (*)(void *, const char *, int),
fpos_t (*)(void *, fpos_t, int),
int (*)(void *));
#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
The SDK also annotates these callback parameters as nullable. Its native header was not edited for the reproduction.
Actual result
Generation exits 2. The diagnostic reports an untyped int passed to a generated func(...) c.Int parameter while generating fropen.
In cl/macrofunc.go:doCompileAutoMacroFunc, these constant arguments reach cb.Val(arg.v) unchanged. The C integer constant 0 is valid as a null function pointer in this argument context; emitting it as an ordinary Go integer loses that meaning.
Expected behavior
Preserve the C null-callback semantics for the detected macro. If this macro shape is outside the supported subset, reject its automatic conversion cleanly instead of starting an invalid Go call and panicking.
Related #1109 lists pointer constants such as NULL and (void *)0 as an open question. This is a reproduced implementation failure on integer literal 0 accepted by the current automatic detection path, rather than a proposal for a new macro API or C wrapper.
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.
- Lingua principale
- Go
- Stelle
- 40
- Fork
- 13
- Merge medio
- 2h 48m
- PR unite (30g)
- 109
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di goplus/llcppg
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
proposal
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
goplus/llcppg#1136 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di goplus/llcppg
Issue simili
-
agent-butler-finding chore
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
jordansmall/spindrift#6695 ·
I maintainer di solito rispondono entro 1 giorno
-
skills-init: commit-SHA skill refs never start (git checkout -- <sha> reads the SHA as a pathspec)Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
kagent-dev/kagent#3571 ·
I maintainer di solito rispondono entro 1 giorno
-
book-layout.spec fails when the similar-books rail holds other projects' booksForse già presa @praetorianer777 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
praetorianer777/GoTome#373 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeoutForse già presa @floriankoch l’ha presa oggi. Apertatriage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
envoyproxy/gateway#10562 ·
I maintainer di solito rispondono entro 1 giorno