Skip to content

add .h file generation tests back #14958

@andrewrk

Description

@andrewrk

Extracted from #14647.

    ctx.h("simple header", linux_x64,
        \\export fn start() void{}
    ,
        \\zig_extern void start(void);
        \\
    );
    ctx.h("header with single param function", linux_x64,
        \\export fn start(a: u8) void{
        \\    _ = a;
        \\}
    ,
        \\zig_extern void start(uint8_t const a0);
        \\
    );
    ctx.h("header with multiple param function", linux_x64,
        \\export fn start(a: u8, b: u8, c: u8) void{
        \\  _ = a; _ = b; _ = c;
        \\}
    ,
        \\zig_extern void start(uint8_t const a0, uint8_t const a1, uint8_t const a2);
        \\
    );
    ctx.h("header with u32 param function", linux_x64,
        \\export fn start(a: u32) void{ _ = a; }
    ,
        \\zig_extern void start(uint32_t const a0);
        \\
    );
    ctx.h("header with usize param function", linux_x64,
        \\export fn start(a: usize) void{ _ = a; }
    ,
        \\zig_extern void start(uintptr_t const a0);
        \\
    );
    ctx.h("header with bool param function", linux_x64,
        \\export fn start(a: bool) void{_ = a;}
    ,
        \\zig_extern void start(bool const a0);
        \\
    );
    ctx.h("header with noreturn function", linux_x64,
        \\export fn start() noreturn {
        \\    unreachable;
        \\}
    ,
        \\zig_extern zig_noreturn void start(void);
        \\
    );
    ctx.h("header with multiple functions", linux_x64,
        \\export fn a() void{}
        \\export fn b() void{}
        \\export fn c() void{}
    ,
        \\zig_extern void a(void);
        \\zig_extern void b(void);
        \\zig_extern void c(void);
        \\
    );
    ctx.h("header with multiple includes", linux_x64,
        \\export fn start(a: u32, b: usize) void{ _ = a; _ = b; }
    ,
        \\zig_extern void start(uint32_t const a0, uintptr_t const a1);
        \\
    );

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioremit-hThis issue is related to generating .h files for C interopregressionIt worked in a previous version of Zig, but stopped working.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions