Skip to content

migrate/c_import: every C void function is emitted with an explicit -> Unit #1838

Closed

Description

@ehartford

The migrator (CiMigrate.w / CImport.w signature rendering) spells every C return type, so a void f(...) becomes fn f(...) -> Unit. With's rule is to omit what the compiler already knows (an absent return type is Unit), and unit-return-review (tools/unit_return_review.w) flags any re-migrated signature that keeps it: re-migrating TommyDS check.c and c-algorithms test-hash-table.c for D75 (#1678, the K&R void stop() / void test_hash_iterator_key_pair() lost their ...) tripped it for exactly those two declarations, which were recorded in docs/unit-return-reviews.tsv as migrator output.

Expected: the migrator omits -> Unit for a void return (declarations, definitions and externs alike), so generated corpora carry no redundant annotation and a re-migration never needs a review entry. Every checked-in corpus would change on its next promote (removals only).

Activity

  1. ehartford commented on Oct 3, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by 7b56d3f (stack #1979, battery green on 029574d). The migrator and c_import omit -> Unit for a void C function only when the rendered body's tail provably infers Unit (ci_def_ret_suffix); a discarded pure read like (void)p lowers to nothing; c-migrator-basic case void_tail_is_unit pins it.

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