Skip to content

Commit ea22ef0

Browse files
authored
Handle disablewarnings for visual studio with clang (#2529)
1 parent 795ed7f commit ea22ef0

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

modules/vstudio/tests/vc2019/test_compile_settings.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,20 @@
192192
<EnableModules>true</EnableModules>
193193
]]
194194
end
195+
196+
--
197+
-- Disable specific warnings.
198+
--
199+
200+
function suite.disableSpecificWarningsWithClang()
201+
disablewarnings { "disable" }
202+
toolset "clang"
203+
prepare()
204+
test.capture [[
205+
<ClCompile>
206+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
207+
<WarningLevel>Level3</WarningLevel>
208+
<Optimization>Disabled</Optimization>
209+
<AdditionalOptions>-Wno-disable %(AdditionalOptions)</AdditionalOptions>
210+
]]
211+
end

modules/vstudio/vs2010_vcxproj.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,7 @@
21612161
if cfg.structmemberalign then
21622162
table.insert(opts, 1, '/Zp' .. tostring(cfg.structmemberalign))
21632163
end
2164+
opts = table.join(opts, table.translate(cfg.disablewarnings, function(disable) return '-Wno-' .. disable end))
21642165
end
21652166

21662167
if #opts > 0 then
@@ -3556,7 +3557,7 @@
35563557

35573558

35583559
function m.disableSpecificWarnings(cfg, condition)
3559-
if #cfg.disablewarnings > 0 then
3560+
if #cfg.disablewarnings > 0 and cfg.toolset ~= "clang" then
35603561
local warnings = table.concat(cfg.disablewarnings, ";")
35613562
warnings = warnings .. ";%%(DisableSpecificWarnings)"
35623563
m.element('DisableSpecificWarnings', condition, warnings)

0 commit comments

Comments
 (0)