Skip to content

Commit fa4b0d1

Browse files
Reapply "[libc] build with -Werror (#73966)"
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
1 parent 12101ca commit fa4b0d1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libc/cmake/modules/LLVMLibCObjectRules.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ function(_get_common_compile_options output_var flags)
4343
list(APPEND compile_options "-fno-rtti")
4444
list(APPEND compile_options "-Wall")
4545
list(APPEND compile_options "-Wextra")
46+
# -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.
47+
if(NOT LIBC_WNO_ERROR)
48+
list(APPEND compile_options "-Werror")
49+
endif()
4650
list(APPEND compile_options "-Wconversion")
4751
list(APPEND compile_options "-Wno-sign-conversion")
4852
list(APPEND compile_options "-Wimplicit-fallthrough")

libc/docs/dev/code_style.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,11 @@ these functions do not call the constructors and destructors of the
178178
allocated/deallocated objects. So, use these functions carefully and only
179179
when it is absolutely clear that constructor and destructor invocation is
180180
not required.
181+
182+
Warnings in sources
183+
===================
184+
185+
We expect contributions to be free of warnings from the `minimum supported
186+
compiler versions`__ (and newer).
187+
188+
.. __: https://libc.llvm.org/compiler_support.html#minimum-supported-versions

0 commit comments

Comments
 (0)