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

[libc] build with -Werror #73966

Merged
merged 4 commits into from Dec 4, 2023
Merged

[libc] build with -Werror #73966

merged 4 commits into from Dec 4, 2023

Conversation

nickdesaulniers
Copy link
Member

A recent commit introduced warnings observable when building unit tests. If the
unit tests don't fail when warnings are introduced into the build, then we
might fail to notice them in the stream of output from check-libc.

Link: https://github.com/llvm/llvm-project/pull/72763/files#r1410932348

@llvmbot llvmbot added the libc label Nov 30, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 30, 2023

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

A recent commit introduced warnings observable when building unit tests. If the
unit tests don't fail when warnings are introduced into the build, then we
might fail to notice them in the stream of output from check-libc.

Link: https://github.com/llvm/llvm-project/pull/72763/files#r1410932348


Full diff: https://github.com/llvm/llvm-project/pull/73966.diff

1 Files Affected:

  • (modified) libc/cmake/modules/LLVMLibCObjectRules.cmake (+1)
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index d5df27a2dcb4341..da14d4767bff2c6 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -35,6 +35,7 @@ function(_get_common_compile_options output_var flags)
     list(APPEND compile_options "-fno-rtti")
     list(APPEND compile_options "-Wall")
     list(APPEND compile_options "-Wextra")
+    list(APPEND compile_options "-Werror")
     list(APPEND compile_options "-Wconversion")
     list(APPEND compile_options "-Wno-sign-conversion")
     list(APPEND compile_options "-Wimplicit-fallthrough")

@jhuber6
Copy link
Contributor

jhuber6 commented Nov 30, 2023

Not permitting any warnings is a pretty big change, likely we'll have some failing builds until they're cleaned up.

@nickdesaulniers
Copy link
Member Author

Is there a way to rekick presubmit tests? I thought if I forced pushed it would, but now it doesn't seem to be happening. Either I misremember or that's not wired up for llvmlibc like the rest of llvm.

Not permitting any warnings is a pretty big change, likely we'll have some failing builds until they're cleaned up.

Besides what coverage we have in presubmits, do you know where else I should look for breakages? Are the build bots all considered post submit (and not pre submit). Sorry, I'm new here.

@jhuber6
Copy link
Contributor

jhuber6 commented Nov 30, 2023

Is there a way to rekick presubmit tests? I thought if I forced pushed it would, but now it doesn't seem to be happening. Either I misremember or that's not wired up for llvmlibc like the rest of llvm.

Not permitting any warnings is a pretty big change, likely we'll have some failing builds until they're cleaned up.

Besides what coverage we have in presubmits, do you know where else I should look for breakages? Are the build bots all considered post submit (and not pre submit). Sorry, I'm new here.

Unsure, I think there's some libc tests that run precommit runs but definitely not all of them. I've seen a handful of warnings before so I don't know if they've all been resolved here.

@jhuber6
Copy link
Contributor

jhuber6 commented Nov 30, 2023

If you don't want to turn it on globally, but have some specific ones in mind, you can probably use -Werror=. For example, I'd like -Werror=global-constructors because they really shouldn't appear by accident.

@nickdesaulniers
Copy link
Member Author

I think it will be good for the long term health of the project that we can compile llvmlibc out of the box without warnings. That doesn't preclude the use of -Wno-* to disable warnings that aren't helpful/applicable, but we really should be striving to ensure warnings aren't creeping in.

@lntue
Copy link
Contributor

lntue commented Dec 1, 2023

How about we add a cmake control flag for this so that other users can control it however fit them, and keep it on by default on our build scripts and bots?

@gchatelet
Copy link
Contributor

Is there a way to rekick presubmit tests? I thought if I forced pushed it would, but now it doesn't seem to be happening. Either I misremember or that's not wired up for llvmlibc like the rest of llvm.

I don't know how to re-kick them but I ran into the same failure yesterday. I rebased + forced push and it buildkite kicked in ¯\_(ツ)_/¯

A recent commit introduced warnings observable when building unit tests. If the
unit tests don't fail when warnings are introduced into the build, then we
might fail to notice them in the stream of output from check-libc.

Link: https://github.com/llvm/llvm-project/pull/72763/files#r1410932348
@nickdesaulniers
Copy link
Member Author

How about we add a cmake control flag for this so that other users can control it however fit them, and keep it on by default on our build scripts and bots?

done PTAL

@SchrodingerZhu
Copy link
Contributor

There is a retry button over there:

image

But, it requires access permission.

@jhuber6
Copy link
Contributor

jhuber6 commented Dec 4, 2023

I wonder if we should mention that libc expects to compile with no warnings in the documentation somewhere. https://libc.llvm.org/dev/index.html.

@nickdesaulniers
Copy link
Member Author

I wonder if we should mention that libc expects to compile with no warnings in the documentation somewhere. https://libc.llvm.org/dev/index.html.

Done in a224d0b, PTAL

@nickdesaulniers nickdesaulniers merged commit 6066530 into llvm:main Dec 4, 2023
4 checks passed
@nickdesaulniers nickdesaulniers deleted the Werror branch December 4, 2023 19:09
@nickdesaulniers
Copy link
Member Author

Now that the build bots are explicitly red, I'm happy to revert this as we get things fixed up.

https://lab.llvm.org/buildbot/#/builders?tags=libc

nickdesaulniers added a commit that referenced this pull request Dec 4, 2023
This reverts commit 6066530.

Post submit buildbots are now red. We can use these explicit errors to better
clean up existing warnings, then reland this.

Link: #73966
@jhuber6
Copy link
Contributor

jhuber6 commented Dec 4, 2023

The GPU build is fine FYI.

nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Jan 8, 2024
This reverts commit 6886a52.

Most of the errors observed in postsubmit have been addressed. We can
fix-forward the remaining ones.

Link: https://lab.llvm.org/buildbot/#/changes/117129
nickdesaulniers added a commit that referenced this pull request Jan 8, 2024
This reverts commit 6886a52.

Most of the errors observed in postsubmit have been addressed. We can
fix-forward the remaining ones.

Link: https://lab.llvm.org/buildbot/#/changes/117129
nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Jan 19, 2024
-Werror is now a global default as of
commit c52b467 ("Reapply "[libc] build with -Werror (llvm#73966)" (llvm#74506)")
nickdesaulniers added a commit that referenced this pull request Jan 19, 2024
-Werror is now a global default as of
commit c52b467 ("Reapply "[libc] build with -Werror (#73966)"
(#74506)")
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
This reverts commit 6886a52.

Most of the errors observed in postsubmit have been addressed. We can
fix-forward the remaining ones.

Link: https://lab.llvm.org/buildbot/#/changes/117129
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants