[llvm-dev] Question about GCC warnings

Neil Nelson via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 18 12:41:15 PDT 2019


Hello Eric,


Not having much experience with LLVM to speak of here ...


It may be useful to compile with a recent version of clang from your  
distribution. On Xubuntu that would be


apt install clang


I am also using the llvm lld linker that does not use as much memory.


apt install lld


The clang build command here is


cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_USE_LINKER=lld  
-DCMAKE_BUILD_TYPE="Release" -DLLVM_ENABLE_ASSERTIONS=On ../llvm &>  
cmake.log


The default CMAKE_BUILD_TYPE is "Debug" that uses more memory and much  
more disk space than "Release".


"LLVM_ENABLE_ASSERTIONS=On" is noted on the Testing Guide page.  
http://llvm.org/docs/TestingGuide.html


Putting all the terminal output in cmake.log allows easy review of any  
issues.


Also add the following two lines to /etc/environment to default to  
compiling with clang. Log out and back in to get these to take. echo $CC  
to confirm.

export CC=clang
export CXX=clang++


The idea of using clang instead of gcc is that any issues should be  
reduced (the context scale is reduced) and that remaining issues will be  
directly related to the user environment on this list.


Regards, Neil Nelson


On 7/18/19 6:00 AM, Erik Hogeman via llvm-dev wrote:
> Hi,
>
> Building LLVM with a newer GCC version seems to generate several  
> compiler warnings, some of which look like false positives. For  
> example, the '-Winit-list-lifetime' warning added in GCC9 triggers for  
> one of the constructors for ArrayRef, the one taking an initializer_list.
>
> How are false positive warnings dealt with in LLVM in general? It's of  
> course possible to just ignore them or use compiler flags to disable  
> them, but with that I think you would risk missing other actual  
> meaningful warnings.
> Would it make sense to add explicit diagnostic pragmas in the code for  
> such cases, to only silence the warning where they are known to be  
> false positives, or would such a patch be likely to face pushback  
> during review?
>
> I apologize if this question is already answered somewhere in the  
> documentation, I tried looking there first but I could not find anything.
>
> Cheers,
> Erik
>
> _______________________________________________ LLVM Developers  
> mailing list llvm-dev at lists.llvm.org  
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190718/afbf5991/attachment.html>


More information about the llvm-dev mailing list