Open
Description
My cmake command:
cmake /llvm/llvm -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt;libc;libclc;lldb;openmp;" \
-DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_USE_LINKER=lld \
-DCMAKE_INSTALL_BINDIR=/Core/Bin \
-DCMAKE_INSTALL_LIBDIR=/Core/LibKit \
-DCMAKE_INSTALL_DOCDIR=/Construct/StoreRoom/Docs \
-DCMAKE_INSTALL_INCLUDEDIR=/Core/APIHeader \
-DCMAKE_INSTALL_MANDIR=/Construct/StoreRoom/Manual \
-DLLVM_ENABLE_WERROR=OFF
Although the llvm docs mention:
LLVM_ENABLE_WERROR:BOOL
Stop and fail the build, if a compiler warning is triggered. Defaults to OFF.
I was getting an error:
[517/8088] Building CXX object projects/libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o
FAILED: projects/libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o
/usr/bin/c++ -DLIBC_NAMESPACE=__llvm_libc_20_1_7_ -I/tmp/build/projects/libc/src/stdio/printf_core -I/llvm/libc/src/stdio/printf_core -I/llvm/libc -isystem /tmp/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -DLIBC_QSORT_IMPL=LIBC_QSORT_QUICK_SORT -DLIBC_ADD_NULL_CHECKS -fpie -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -fext-numeric-literals -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -std=c++17 -MD -MT projects/libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -MF projects/libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o.d -o projects/libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -c /llvm/libc/src/stdio/printf_core/converter.cpp
In file included from /llvm/libc/src/__support/uint128.h:12,
from /llvm/libc/src/__support/FPUtil/FPBits.h:27,
from /llvm/libc/src/stdio/printf_core/core_structs.h:16,
from /llvm/libc/src/stdio/printf_core/converter.h:13,
from /llvm/libc/src/stdio/printf_core/converter.cpp:9:
In member function 'constexpr __llvm_libc_20_1_7_::cpp::optional<__llvm_libc_20_1_7_::BigInt<Bits, Signed, WordType> > __llvm_libc_20_1_7_::BigInt<Bits, Signed, WordType>::div_uint_half_times_pow_2(__llvm_libc_20_1_7_::multiword::half_width_t<WordType>, size_t) [with long unsigned int Bits = 16512; bool Signed = false; WordType = long unsigned int]',
inlined from 'static constexpr __llvm_libc_20_1_7_::BlockInt __llvm_libc_20_1_7_::FloatToString<long double>::grab_digits(__llvm_libc_20_1_7_::UInt<Bits>&) [with long unsigned int Bits = 16512]' at /llvm/libc/src/__support/float_to_string.h:653:57,
inlined from 'constexpr void __llvm_libc_20_1_7_::FloatToString<long double>::init_convert()' at /llvm/libc/src/__support/float_to_string.h:691:62:
/llvm/libc/src/__support/big_int.h:795:26: error: iteration 258 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
795 | remainder[pos - 1] = val[pos - 1];
| ~~~~~~~~~~~~~~~~~~~^~~~~~
/llvm/libc/src/__support/big_int.h:794:16: note: within this loop
794 | for (; pos > 0; --pos) {
| ~~~~^~~
cc1plus: all warnings being treated as errors
I looked around for a while, and found out that adding another flag: -DCMAKE_CXX_FLAGS="-Wno-error"
And it still has the same issue.