aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Desaulniers <nickdesaulniers@users.noreply.github.com>2023-12-04 11:08:59 -0800
committerGitHub <noreply@github.com>2023-12-04 11:08:59 -0800
commit606653091d1a66d1a83a1bfdea2883cc8d46687e (patch)
tree603a34ad5483747804d5d7a292665351afb11e36
parentc33e5d59e5dd4f54c3f4cc00d1bedaf644fdb694 (diff)
downloadllvm-606653091d1a66d1a83a1bfdea2883cc8d46687e.zip
llvm-606653091d1a66d1a83a1bfdea2883cc8d46687e.tar.gz
llvm-606653091d1a66d1a83a1bfdea2883cc8d46687e.tar.bz2
[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
-rw-r--r--libc/cmake/modules/LLVMLibCObjectRules.cmake4
-rw-r--r--libc/docs/dev/code_style.rst8
2 files changed, 12 insertions, 0 deletions
diff --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 5fbbfd5..ef654bd 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -43,6 +43,10 @@ function(_get_common_compile_options output_var flags)
list(APPEND compile_options "-fno-rtti")
list(APPEND compile_options "-Wall")
list(APPEND compile_options "-Wextra")
+ # -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.
+ if(NOT LIBC_WNO_ERROR)
+ list(APPEND compile_options "-Werror")
+ endif()
list(APPEND compile_options "-Wconversion")
list(APPEND compile_options "-Wno-sign-conversion")
list(APPEND compile_options "-Wimplicit-fallthrough")
diff --git a/libc/docs/dev/code_style.rst b/libc/docs/dev/code_style.rst
index a050a4c..eeeced0 100644
--- a/libc/docs/dev/code_style.rst
+++ b/libc/docs/dev/code_style.rst
@@ -178,3 +178,11 @@ these functions do not call the constructors and destructors of the
allocated/deallocated objects. So, use these functions carefully and only
when it is absolutely clear that constructor and destructor invocation is
not required.
+
+Warnings in sources
+===================
+
+We expect contributions to be free of warnings from the `minimum supported
+compiler versions`__ (and newer).
+
+.. __: https://libc.llvm.org/compiler_support.html#minimum-supported-versions