fix(cl): avoid panicking on a BlockPointer member during union accessor generation
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 40
- Forks
- 13
- Merge medio
- 2 h
- PR fusionados (30 d)
- 150
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de goplus/llcppg
-
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
goplus/llcppg#1136 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
goplus/llcppg#1133 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de goplus/llcppg
Issues similares
-
needs-area
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/typespec-azure#5936 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
-
Fix mode unpins a reusable workflow call when the same repository is also used as a step actionAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
github/gh-actions-lock#261 ·
Los mantenedores suelen responder en 1 día
-
bug documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
labmonkeys-space/nl6#974 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100