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

Remove comment header from generated output of Build.ConfigHeader #19272

Open
g012 opened this issue Mar 12, 2024 · 3 comments · May be fixed by #19277
Open

Remove comment header from generated output of Build.ConfigHeader #19272

g012 opened this issue Mar 12, 2024 · 3 comments · May be fixed by #19277
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@g012
Copy link

g012 commented Mar 12, 2024

Zig Version

0.12.0-dev.3161+377ecc6af

Steps to Reproduce and Observed Behavior

When using b.addConfigHeader() in build.zig, a C or ASM comment is forcefully prepended in the generated output file ; from ConfigHeader.zig:

    const header_text = "This file was generated by ConfigHeader using the Zig Build System.";
    const c_generated_line = "/* " ++ header_text ++ " */\n";
    const asm_generated_line = "; " ++ header_text ++ "\n";
...
            try output.appendSlice(c_generated_line);

I use ConfigHeader with an existing lua.in file to generate a Lua file, as I'm migrating from CMake to build.zig, and in Lua /* */ or ; comments are invalid. Can you add an option to customize and remove this automatically added comment ?

Expected Behavior

I would like no extra text added to the generated file of ConfigHeader.

@g012 g012 added the bug Observed behavior contradicts documented or intended behavior label Mar 12, 2024
@g012
Copy link
Author

g012 commented Mar 12, 2024

Real-world example here: https://github.com/g012/l65/blob/master/build.zig

@Vexu Vexu added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Mar 26, 2024
@Vexu Vexu added this to the 0.12.0 milestone Mar 26, 2024
@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. and removed bug Observed behavior contradicts documented or intended behavior labels Apr 6, 2024
@andrewrk andrewrk modified the milestones: 0.12.0, 0.13.0 Apr 6, 2024
@andrewrk
Copy link
Member

andrewrk commented Apr 6, 2024

Sure, go ahead and add the option. This is a contributor-friendly enhancement.

@Lking03x
Copy link

Lking03x commented May 5, 2024

@andrewrk
#20018
This should solve the issue. It implements some suggestions from #19277 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants