Changed C++20 to emit C++20 instead of C++Latest in MSVC, Added C11 and C17

This commit is contained in:
Nicholaus Clark 2021-11-06 12:19:58 -05:00
parent b1d477ff33
commit a276fe8ee9
4 changed files with 62 additions and 2 deletions

View File

@ -1338,6 +1338,21 @@
]]
end
function suite.onLanguage_Cpp20_VS2017()
p.action.set("vs2017")
cppdialect 'C++20'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
]]
end
function suite.onLanguage_Cpp20_VS2019()
p.action.set("vs2019")
@ -1348,7 +1363,37 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<LanguageStandard>stdcpplatest</LanguageStandard>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
]]
end
function suite.onLanguage_C11_VS2019()
p.action.set("vs2019")
cdialect 'C11'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
]]
end
function suite.onLanguage_C17_VS2019()
p.action.set("vs2019")
cdialect 'C17'
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<LanguageStandard_C>stdc17</LanguageStandard_C>
</ClCompile>
]]
end

View File

@ -389,6 +389,7 @@
m.compileAs,
m.callingConvention,
m.languageStandard,
m.languageStandardC,
m.conformanceMode,
m.structMemberAlignment,
m.useFullPaths,
@ -1477,13 +1478,25 @@
elseif (cfg.cppdialect == "C++17") then
m.element("LanguageStandard", nil, 'stdcpp17')
elseif (cfg.cppdialect == "C++20") then
m.element("LanguageStandard", nil, 'stdcpplatest')
m.element("LanguageStandard", nil, iif(_ACTION == "vs2017", 'stdcpplatest', 'stdcpp20'))
elseif (cfg.cppdialect == "C++latest") then
m.element("LanguageStandard", nil, 'stdcpplatest')
end
end
end
function m.languageStandardC(cfg)
if _ACTION >= "vs2019" then
if (cfg.cdialect == "C11") then
m.element("LanguageStandard_C", nil, 'stdc11')
elseif (cfg.cdialect == "C17") then
m.element("LanguageStandard_C", nil, 'stdc17')
end
end
end
function m.conformanceMode(cfg)
if _ACTION >= "vs2017" then
if cfg.conformancemode ~= nil then

View File

@ -757,6 +757,7 @@
"C90",
"C99",
"C11",
"C17",
"gnu89",
"gnu90",
"gnu99",

View File

@ -13,6 +13,7 @@ cdialect "value"
* `C90`: ISO C90
* `C99`: ISO C99
* `C11`: ISO C11
* `C17`: ISO C17
* `gnu89`: GNU dialect of ISO C89
* `gnu90`: GNU dialect of ISO C90
* `gnu99`: GNU dialect of ISO C99