Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add .h file generation tests back #14958

Open
Tracked by #14647
andrewrk opened this issue Mar 17, 2023 · 0 comments
Open
Tracked by #14647

add .h file generation tests back #14958

andrewrk opened this issue Mar 17, 2023 · 0 comments
Labels
bug Observed behavior contradicts documented or intended behavior emit-h This issue is related to generating .h files for C interop regression It worked in a previous version of Zig, but stopped working.
Milestone

Comments

@andrewrk
Copy link
Member

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);
        \\
    );

@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior emit-h This issue is related to generating .h files for C interop regression It worked in a previous version of Zig, but stopped working. labels Mar 17, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone Mar 17, 2023
@andrewrk andrewrk modified the milestones: 0.11.0, 0.12.0 Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior emit-h This issue is related to generating .h files for C interop regression It worked in a previous version of Zig, but stopped working.
Projects
None yet
Development

No branches or pull requests

1 participant