Skip to content

Define migrator behavior for variadic function definitions #174

Closed

Description

@ehartford

The C migrator supports variadic extern declarations and variadic call sites, as demonstrated by the std.libc surface for functions such as fprintf and printf. The unresolved design question is how to handle C functions that define a variadic body, for example helper functions that use va_list/va_start/va_arg/va_end internally.

Today this is easy to mishandle by emitting a stub or placeholder for the unsupported definition, which violates the migrator policy: generated output must either be semantically correct or fail loudly with a diagnostic and non-zero exit. We should decide whether the migrator should translate variadic definitions correctly, or detect them and fail loudly with source location and function name.

Scope notes:

  • Variadic externs are not the problem.
  • Variadic calls are not the problem.
  • The question is specifically C variadic function definitions in migrated output.
  • Until implemented, silently generating Never, comptime_error, panic, return 0, or any placeholder body is not acceptable.

Activity

  1. ehartford commented on May 29, 2026

    @ehartford
    ContributorAuthor

    Closed by 025a397 on main.\n\nRoot cause: ci_migrate_translate_function treated variadic C function definitions as ordinary functions after only using the variadic bit for signature printing, so va_list/va_start/va_arg bodies were lowered into bogus With and reported success.\n\nFix: variadic C function definitions now fail loudly and non-zero with the function name and source location unless they are a deliberately implemented special case. Variadic declarations remain supported.\n\nRegression: c-migrator-basic now verifies the failing exit status, diagnostic text/location, and that no .w output is produced.\n\nVerified: make build, make fixpoint, make test, make install-user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions