Skip to content

Commit 26236fc

Browse files
update a function to enable some warning for specified target
Signed-off-by: Zhu, Shaojie <[email protected]>
1 parent 899b076 commit 26236fc

File tree

45 files changed

+159
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+159
-186
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,16 @@ if (MSVC)
769769
endforeach(flag)
770770
endif (MSVC)
771771

772+
function(enable_msvc_warnings_on_compiler_for_driver target_name enable_warning_level)
773+
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
774+
set(warnings ${ARGN})
775+
foreach(warning ${warnings})
776+
list(APPEND warning_flags "${enable_warning_level}${warning}")
777+
endforeach()
778+
target_compile_options(${target_name} PRIVATE ${warning_flags})
779+
endif()
780+
endfunction()
781+
772782
if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
773783

774784
# Don't add -Wall for clang-cl, because it maps -Wall to -Weverything for

llvm/lib/Analysis/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ add_llvm_component_library(LLVMAnalysis
162162
TargetParser
163163
)
164164

165-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
166-
target_compile_options(LLVMAnalysis PRIVATE
167-
/w34146 /w34244 /w34267
168-
)
169-
endif()
165+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
166+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
167+
enable_msvc_warnings_on_compiler_for_driver(LLVMAnalysis /w3 4146 4244 4267)

llvm/lib/BinaryFormat/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ add_llvm_component_library(LLVMBinaryFormat
2222
TargetParser
2323
)
2424

25-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
26-
target_compile_options(LLVMBinaryFormat PRIVATE
27-
/w34146 /w34244 /w34267
28-
)
29-
endif()
25+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
26+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
27+
enable_msvc_warnings_on_compiler_for_driver(LLVMBinaryFormat /w3 4146 4244 4267)

llvm/lib/Bitcode/Reader/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ add_llvm_component_library(LLVMBitReader
1818
TargetParser
1919
)
2020

21-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
22-
target_compile_options(LLVMBitReader PRIVATE
23-
/w34146 /w34244 /w34267
24-
)
25-
endif()
21+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
22+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
23+
enable_msvc_warnings_on_compiler_for_driver(LLVMBitReader /w3 4146 4244 4267)

llvm/lib/Frontend/Offloading/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ add_llvm_component_library(LLVMFrontendOffloading
1616
TargetParser
1717
)
1818

19-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
20-
target_compile_options(LLVMFrontendOffloading PRIVATE
21-
/w34146 /w34244 /w34267
22-
)
23-
endif()
19+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
20+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
21+
enable_msvc_warnings_on_compiler_for_driver(LLVMFrontendOffloading /w3 4146 4244 4267)

llvm/lib/Frontend/OpenMP/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ add_llvm_component_library(LLVMFrontendOpenMP
2323
FrontendOffloading
2424
)
2525

26-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
27-
target_compile_options(LLVMFrontendOpenMP PRIVATE
28-
/w34146 /w34244 /w34267
29-
)
30-
endif()
26+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
27+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
28+
enable_msvc_warnings_on_compiler_for_driver(LLVMFrontendOpenMP /w3 4146 4244 4267)

llvm/lib/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ add_llvm_component_library(LLVMCore
8888
TargetParser
8989
)
9090

91-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
92-
target_compile_options(LLVMCore PRIVATE
93-
/w34146 /w34244 /w34267
94-
)
95-
endif()
91+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
92+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
93+
enable_msvc_warnings_on_compiler_for_driver(LLVMCore /w3 4146 4244 4267)

llvm/lib/ProfileData/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ add_llvm_component_library(LLVMProfileData
2929
TargetParser
3030
)
3131

32-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
33-
target_compile_options(LLVMProfileData PRIVATE
34-
/w34146 /w34244 /w34267
35-
)
36-
endif()
32+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
33+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
34+
enable_msvc_warnings_on_compiler_for_driver(LLVMProfileData /w3 4146 4244 4267)
3735

3836
add_subdirectory(Coverage)

llvm/lib/Remarks/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ add_llvm_component_library(LLVMRemarks
2222
intrinsics_gen
2323
)
2424

25-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
26-
target_compile_options(LLVMRemarks PRIVATE
27-
/w34146 /w34244 /w34267
28-
)
29-
endif()
25+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
26+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
27+
enable_msvc_warnings_on_compiler_for_driver(LLVMRemarks /w3 4146 4244 4267)

llvm/lib/Support/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,9 @@ add_llvm_component_library(LLVMSupport
292292
Demangle
293293
)
294294

295-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
296-
target_compile_options(LLVMSupport PRIVATE
297-
/w34146 /w34244 /w34267
298-
)
299-
endif()
295+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
296+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
297+
enable_msvc_warnings_on_compiler_for_driver(LLVMSupport /w3 4146 4244 4267)
300298

301299
set(llvm_system_libs ${system_libs})
302300

llvm/lib/TargetParser/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ add_llvm_component_library(LLVMTargetParser
4040
RISCVTargetParserTableGen
4141
)
4242

43-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
44-
target_compile_options(LLVMTargetParser PRIVATE
45-
/w34146 /w34244 /w34267
46-
)
47-
endif()
43+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
44+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
45+
enable_msvc_warnings_on_compiler_for_driver(LLVMTargetParser /w3 4146 4244 4267)

llvm/lib/Transforms/Scalar/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ add_llvm_component_library(LLVMScalarOpts
9999
TransformUtils
100100
)
101101

102-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
103-
target_compile_options(LLVMScalarOpts PRIVATE
104-
/w34146 /w34244 /w34267
105-
)
106-
endif()
102+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
103+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
104+
enable_msvc_warnings_on_compiler_for_driver(LLVMScalarOpts /w3 4146 4244 4267)

llvm/lib/Transforms/Utils/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ add_llvm_component_library(LLVMTransformUtils
100100
TargetParser
101101
)
102102

103-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
104-
target_compile_options(LLVMTransformUtils PRIVATE
105-
/w34146 /w34244 /w34267
106-
)
107-
endif()
103+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
104+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
105+
enable_msvc_warnings_on_compiler_for_driver(LLVMTransformUtils /w3 4146 4244 4267)

mlir/lib/Analysis/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ add_mlir_library(MLIRAnalysis
5757
MLIRViewLikeInterface
5858
)
5959

60-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
61-
target_compile_options(MLIRAnalysis PRIVATE
62-
/w34146 /w34244 /w34267
63-
)
64-
endif()
60+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
61+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
62+
enable_msvc_warnings_on_compiler_for_driver(MLIRAnalysis /w3 4146 4244 4267)

mlir/lib/AsmParser/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ add_mlir_library(MLIRAsmParser
1616
MLIRIR
1717
)
1818

19-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
20-
target_compile_options(MLIRAsmParser PRIVATE
21-
/w34146 /w34244 /w34267
22-
)
23-
endif()
19+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
20+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
21+
enable_msvc_warnings_on_compiler_for_driver(MLIRAsmParser /w3 4146 4244 4267)

mlir/lib/Conversion/AffineToStandard/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ add_mlir_conversion_library(MLIRAffineToStandard
2222
MLIRVectorDialect
2323
)
2424

25-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
26-
target_compile_options(MLIRAffineToStandard PRIVATE
27-
/w34146 /w34244 /w34267
28-
)
29-
endif()
25+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
26+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
27+
enable_msvc_warnings_on_compiler_for_driver(MLIRAffineToStandard /w3 4146 4244 4267)

mlir/lib/Conversion/ArithCommon/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ add_mlir_conversion_library(MLIRArithAttrToLLVMConversion
99
MLIRLLVMDialect
1010
)
1111

12-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
13-
target_compile_options(MLIRArithAttrToLLVMConversion PRIVATE
14-
/w34146 /w34244 /w34267
15-
)
16-
endif()
12+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
13+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
14+
enable_msvc_warnings_on_compiler_for_driver(MLIRArithAttrToLLVMConversion /w3 4146 4244 4267)

mlir/lib/Conversion/ArithToLLVM/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ add_mlir_conversion_library(MLIRArithToLLVM
1717
MLIRLLVMDialect
1818
)
1919

20-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
21-
target_compile_options(MLIRArithToLLVM PRIVATE
22-
/w34146 /w34244 /w34267
23-
)
24-
endif()
20+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
21+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
22+
enable_msvc_warnings_on_compiler_for_driver(MLIRArithToLLVM /w3 4146 4244 4267)

mlir/lib/Conversion/ControlFlowToLLVM/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ add_mlir_conversion_library(MLIRControlFlowToLLVM
2020
MLIRTransformUtils
2121
)
2222

23-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
24-
target_compile_options(MLIRControlFlowToLLVM PRIVATE
25-
/w34146 /w34244 /w34267
26-
)
27-
endif()
23+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
24+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
25+
enable_msvc_warnings_on_compiler_for_driver(MLIRControlFlowToLLVM /w3 4146 4244 4267)

mlir/lib/Conversion/FuncToLLVM/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ add_mlir_conversion_library(MLIRFuncToLLVM
2222
MLIRTransformUtils
2323
)
2424

25-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
26-
target_compile_options(MLIRFuncToLLVM PRIVATE
27-
/w34146 /w34244 /w34267
28-
)
29-
endif()
25+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
26+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
27+
enable_msvc_warnings_on_compiler_for_driver(MLIRFuncToLLVM /w3 4146 4244 4267)

mlir/lib/Conversion/IndexToLLVM/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ add_mlir_conversion_library(MLIRIndexToLLVM
1515
MLIRLLVMCommonConversion
1616
MLIRLLVMDialect
1717
)
18+
19+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
20+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
21+
enable_msvc_warnings_on_compiler_for_driver(MLIRIndexToLLVM /w3 4146 4244 4267)

mlir/lib/Conversion/LLVMCommon/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ add_mlir_conversion_library(MLIRLLVMCommonConversion
1717
MLIRSupport
1818
MLIRTransforms
1919
)
20+
21+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
22+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
23+
enable_msvc_warnings_on_compiler_for_driver(MLIRLLVMCommonConversion /w3 4146 4244 4267)

mlir/lib/Dialect/Affine/Analysis/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ add_mlir_dialect_library(MLIRAffineAnalysis
2020
MLIRSCFDialect
2121
)
2222

23-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
24-
target_compile_options(MLIRAffineAnalysis PRIVATE
25-
/w34146 /w34244 /w34267
26-
)
27-
endif()
23+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
24+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
25+
enable_msvc_warnings_on_compiler_for_driver(MLIRAffineAnalysis /w3 4146 4244 4267)

mlir/lib/Dialect/Affine/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ add_mlir_dialect_library(MLIRAffineDialect
2424
MLIRValueBoundsOpInterface
2525
)
2626

27-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
28-
target_compile_options(MLIRAffineDialect PRIVATE
29-
/w34146 /w34244 /w34267
30-
)
31-
endif()
27+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
28+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
29+
enable_msvc_warnings_on_compiler_for_driver(MLIRAffineDialect /w3 4146 4244 4267)

mlir/lib/Dialect/Affine/Utils/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ add_mlir_dialect_library(MLIRAffineUtils
1818
MLIRViewLikeInterface
1919
)
2020

21-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
22-
target_compile_options(MLIRAffineUtils PRIVATE
23-
/w34146 /w34244 /w34267
24-
)
25-
endif()
21+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
22+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
23+
enable_msvc_warnings_on_compiler_for_driver(MLIRAffineUtils /w3 4146 4244 4267)

mlir/lib/Dialect/Arith/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ add_mlir_dialect_library(MLIRArithValueBoundsOpInterfaceImpl
4444
MLIRValueBoundsOpInterface
4545
)
4646

47-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
48-
target_compile_options(MLIRArithDialect PRIVATE
49-
/w34146 /w34244 /w34267
50-
)
51-
endif()
47+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
48+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
49+
enable_msvc_warnings_on_compiler_for_driver(MLIRArithDialect /w3 4146 4244 4267)

mlir/lib/Dialect/Arith/Utils/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ add_mlir_dialect_library(MLIRArithUtils
1111
MLIRIR
1212
)
1313

14-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
15-
target_compile_options(MLIRArithUtils PRIVATE
16-
/w34146 /w34244 /w34267
17-
)
18-
endif()
14+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
15+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
16+
enable_msvc_warnings_on_compiler_for_driver(MLIRArithUtils /w3 4146 4244 4267)

mlir/lib/Dialect/Async/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ add_mlir_dialect_library(MLIRAsyncDialect
1515
MLIRIR
1616
)
1717

18-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
19-
target_compile_options(MLIRAsyncDialect PRIVATE
20-
/w34146 /w34244 /w34267
21-
)
22-
endif()
18+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
19+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
20+
enable_msvc_warnings_on_compiler_for_driver(MLIRAsyncDialect /w3 4146 4244 4267)

mlir/lib/Dialect/Bufferization/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ add_mlir_dialect_library(MLIRBufferizationDialect
2929
MLIRBufferizationAllExtensions
3030
)
3131

32-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
33-
target_compile_options(MLIRBufferizationDialect PRIVATE
34-
/w34146 /w34244 /w34267
35-
)
36-
endif()
32+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
33+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
34+
enable_msvc_warnings_on_compiler_for_driver(MLIRBufferizationDialect /w3 4146 4244 4267)

mlir/lib/Dialect/Bufferization/Transforms/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ add_mlir_dialect_library(MLIRBufferizationTransforms
4242
MLIRSupport
4343
)
4444

45-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
46-
target_compile_options(MLIRBufferizationTransforms PRIVATE
47-
/w34146 /w34244 /w34267
48-
)
49-
endif()
45+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
46+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
47+
enable_msvc_warnings_on_compiler_for_driver(MLIRBufferizationTransforms /w3 4146 4244 4267)

mlir/lib/Dialect/Complex/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ add_mlir_dialect_library(MLIRComplexDialect
1717
MLIRIR
1818
)
1919

20-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
21-
target_compile_options(MLIRComplexDialect PRIVATE
22-
/w34146 /w34244 /w34267
23-
)
24-
endif()
20+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
21+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
22+
enable_msvc_warnings_on_compiler_for_driver(MLIRComplexDialect /w3 4146 4244 4267)

mlir/lib/Dialect/ControlFlow/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ add_mlir_dialect_library(MLIRControlFlowDialect
1414
MLIRSideEffectInterfaces
1515
)
1616

17-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
18-
target_compile_options(MLIRControlFlowDialect PRIVATE
19-
/w34146 /w34244 /w34267
20-
)
21-
endif()
17+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
18+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
19+
enable_msvc_warnings_on_compiler_for_driver(MLIRControlFlowDialect /w3 4146 4244 4267)

mlir/lib/Dialect/Func/IR/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ add_mlir_dialect_library(MLIRFuncDialect
1616
MLIRSideEffectInterfaces
1717
)
1818

19-
if(MSVC AND BUILD_COMPILER_FOR_DRIVER)
20-
target_compile_options(MLIRFuncDialect PRIVATE
21-
/w34146 /w34244 /w34267
22-
)
23-
endif()
19+
# Due to this target cannot pass the binskim scan after the compiler in the driver build,
20+
# it is necessary to remove the suppression of these three warnings(/wd4146 /wd4244 /wd4267).
21+
enable_msvc_warnings_on_compiler_for_driver(MLIRFuncDialect /w3 4146 4244 4267)

0 commit comments

Comments
 (0)