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

compiler: Enable -Werror=date-time for C/C++ code in release builds #20821

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Jul 27, 2024

We advertise reproducible builds for release modes, so let's help users achieve that in C/C++ code. Users can still override this manually if they really want.

@alexrp
Copy link
Member Author

alexrp commented Jul 27, 2024

I could also make this -Werror=date-time, assuming we like this change. Done.

@andrewrk
Copy link
Member

Nice idea. Here's my counter-proposal.

The langref says that Debug is not required to make reproducible builds, but all the release modes are required to make reproducible builds. There is currently no option for changing this with compilation flags. Let's start by continuing to not having an option to override this, and do what zig cc always does: try to give you the zig build mode even when compiling C source files.

In this case, it means that we do, in fact, set -Werror=date-time for release builds, because that is required for reproducible builds. Users who want to opt out of this can do so by directly overriding this flag because we put the user-specified clang flags after the ones generated by Zig.

We advertise reproducible builds for release modes, so let's help users achieve
that in C/C++ code. Users can still override this manually if they really want.
@alexrp alexrp changed the title compiler: Enable -Wdate-time for C/C++ code in most Zig commands. compiler: Enable -Werror=date-time for C/C++ code in release builds Jul 29, 2024
@alexrp
Copy link
Member Author

alexrp commented Jul 29, 2024

Ok, changed it to simply always pass -Werror=date-time if the module's mode is not Debug.

@andrewrk
Copy link
Member

Thanks. I think that commit message would have also worked well as a comment, but it's good enough that someone can use git blame to find it.

@andrewrk andrewrk merged commit 27507ad into ziglang:master Jul 29, 2024
10 checks passed
@alexrp alexrp deleted the warn-date-time branch July 29, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants