Skip to content

fix(c/setjmp): generate native pointer parameters - #52

Draft
MeteorsLiu wants to merge 2 commits into
goplus:mainfrom
MeteorsLiu:codex/c-setjmp-native-bindings
Draft

MeteorsLiu wants to merge 2 commits into
goplus:mainfrom
MeteorsLiu:codex/c-setjmp-native-bindings

Conversation

@MeteorsLiu

@MeteorsLiu MeteorsLiu commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Generate native jump-buffer parameters as pointers so setjmp writes caller-owned storage.

The implementation includes:

  • Canonicalize C array-typedef parameters to Clang-equivalent pointer declarations before generation, with C function-type equality checks.
  • Keep generated __sigsetjmp methods with their owning jump-buffer type and restore jmp_buf/sigjmp_buf mappings.
  • Preserve the existing compatibility API and test that the initial native setjmp changes the caller buffer without executing longjmp.
  • Validation: llgo build and llgo test -v ./c/setjmp pass on macOS arm64, Linux amd64 and Linux arm64, both normally and with -tags=nogc, using the combined prerequisite snapshot.

Generated with unmodified llcppg main da227ff4, macOS SDK 14.0 and the oldest Bootlin stable glibc 2.24 headers. The build/test results cover the current native environments.

The native API is now generated without dropping declarations merely because compatibility code already exists.

@MeteorsLiu

MeteorsLiu commented Oct 19, 2026 •

Copy link
Copy Markdown
Member Author

Merge order: #45 → #51 → #48 → #49 → #44 → #47 → #46 → #50 → #52.

Each draft changes one folder only. This refresh regenerates native APIs without omitting functions merely to preserve handwritten entry points. Existing compatibility APIs remain available; colliding native names use the Native prefix.

The combined prerequisite snapshot passes llgo build and executed llgo test runs on macOS arm64, Linux amd64 and Linux arm64, both with GC and -tags=nogc (54 package test runs and 6 complete builds). Generation uses unmodified llcppg main da227ff4, macOS SDK 14.0 and Bootlin glibc 2.24 headers. The earlier Timeval receiver and Signal layout failures are resolved.

These PRs remain draft for review. Documented generator/ABI failures and previously approved va_list exclusions remain; there are zero handwritten-retention exclusions.

@MeteorsLiu MeteorsLiu changed the title feat(c/setjmp): add classified native jump APIs fix(c/setjmp): generate native pointer parameters Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant