Skip to content

Commit 6066530

Browse files
[libc] build with -Werror (#73966)
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
1 parent c33e5d5 commit 6066530

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)