Skip to content

feat(flowc): parse extern block signatures and emit forward declarations - #457

Merged
godofecht merged 1 commit into
mainfrom
work6
Aug 12, 2026
Merged

godofecht merged 1 commit into
mainfrom
work6

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Summary

The extern block parser previously skipped the brace contents without parsing function signatures. Now it parses each function name(params) -> Ret as an AST_FN node with no body, chained as children of the AST_EXTERN node.

The C generator emits forward declarations for extern functions in a new Pass 2.7, skipping C standard library functions already declared by the included headers (stdio.h, stdlib.h, string.h, math.h).

Also handles variadic ... in extern function parameters.

Test plan

  • Self-host fixed-point passes (byte-identical)
  • Self-compile audit: all compiler/src modules pass
  • Roundtrip: all checks pass
  • Stdlib scan: OK=38 (up from 32)

This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.

Generated with Devin

The extern block parser previously skipped the brace contents without
parsing function signatures. Now it parses each function signature as
an AST_FN node with no body, chained as children of the AST_EXTERN node.

The C generator emits forward declarations for extern functions in a
new Pass 2.7, skipping C standard library functions already declared
by the included headers (stdio.h, stdlib.h, string.h, math.h).

Also handles variadic ... in extern function parameters.

Updates test_parse_extern and test_parse_fixture_file to expect the
additional AST_FN nodes from parsed extern signatures.

Stdlib scan: OK=38 (up from 32).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cursor

cursor Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@godofecht
godofecht merged commit 5766367 into main Aug 12, 2026
15 checks passed
@godofecht
godofecht deleted the work6 branch August 12, 2026 17:53
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