[llvm-dev] Miscellaneous warnings in code using Visual Studio

Machiel van Hooren via llvm-dev llvm-dev at lists.llvm.org
Tue Jan 19 07:30:00 PST 2021


I've had similar issues with warnings from LLVM headers with Visual Studio.
The way I've dealt with this is this to use the experimental /external 
compiler flags within Visual Studio which allow control of warning 
levels from external headers.

For example adding these flags will set warning level to W0 for all 
include files that are included with angle brackets:

/experimental:external /external:anglebrackets /external:W0

This is a bit crude because you can't target specific libraries, but it 
might still be helpful depending on your application.

Regards,

Machiel van Hooren

On 12-Jan-21 18:14, Paul C. Anagnostopoulos via llvm-dev wrote:
> When I build on Windows 7 with Visual Studio, I get various warnings that were ignored until I recently set
>
> LLVM_ENABLE_WERROR:BOOL=ON
>
> One example is shown below. Should I take the time to hunt these down and fix them?
>
>
> **********************************************************************
> ** Visual Studio 2019 Developer Command Prompt v16.8.1
> ** Copyright (c) 2020 Microsoft Corporation
> **********************************************************************
>
> D:\LLVM\build>build-targets.bat
>          1 file(s) copied.
> [363/1578] Building CXX object lib\CodeGen\...LLVMGlobalISel.dir\MachineIRBuilder.cpp.obj
> FAILED: lib/CodeGen/GlobalISel/CMakeFiles/LLVMGlobalISel.dir/MachineIRBuilder.cpp.obj
> C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1428~1.293\bin\Hostx86\x86\cl.exe  /nolog
> o /TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
> -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_FILE_OFFSET_BITS=64 -D_HAS_EXCEPTI
> ONS=0 -D_LARGEFILE_SOURCE -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib\CodeGen\Global
> ISel -IC:\LLVM\llvm-project\llvm\lib\CodeGen\GlobalISel -Iinclude -IC:\LLVM\llvm-project\l
> lvm\include /DWIN32 /D_WINDOWS   /WX /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi /Zc:
> rvalueCast /bigobj /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd
> 4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd47
> 02 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091
>   -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /MDd /Zi /Ob0 /Od /RTC1  /EHs-c- /GR- -st
> d:c++14 /showIncludes /Folib\CodeGen\GlobalISel\CMakeFiles\LLVMGlobalISel.dir\MachineIRBui
> lder.cpp.obj /Fdlib\CodeGen\GlobalISel\CMakeFiles\LLVMGlobalISel.dir\LLVMGlobalISel.pdb /F
> S -c C:\LLVM\llvm-project\llvm\lib\CodeGen\GlobalISel\MachineIRBuilder.cpp
> C:\LLVM\llvm-project\llvm\lib\CodeGen\GlobalISel\MachineIRBuilder.cpp(657): error C2220: t
> he following warning is treated as an error
> C:\LLVM\llvm-project\llvm\lib\CodeGen\GlobalISel\MachineIRBuilder.cpp(657): warning C4018:
>   '>=': signed/unsigned mismatch
> [366/1578] Building CXX object lib\CodeGen\...CMakeFiles\LLVMGlobalISel.dir\Utils.cpp.obj
> ninja: build stopped: subcommand failed.
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list