Skip to content

Commit 4295f90

Browse files
authored
test MSVC default conformance mode, using its legacy lambda processor (#253)
1 parent d1eed09 commit 4295f90

File tree

5 files changed

+146
-2
lines changed

5 files changed

+146
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ jobs:
112112
type:
113113
- "debug"
114114
- "release"
115+
permissive:
116+
- false
117+
- true
115118

116119
runs-on: windows-2022
117120

@@ -130,7 +133,7 @@ jobs:
130133
- uses: ilammy/msvc-dev-cmd@v1
131134

132135
- name: Configure Meson
133-
run: meson setup build --vsenv --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false
136+
run: meson setup build --vsenv --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false -Dpermissive=${{ matrix.permissive }}
134137

135138
- name: Build
136139
run: meson compile -C build

meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ is_devel = get_option('devel')
3636
is_debug = get_option('debug')
3737
is_release = not is_debug
3838
is_pedantic = get_option('pedantic') or is_devel
39+
is_permissive = get_option('permissive')
3940
is_windows = host_machine.system() == 'windows'
4041
is_x64 = host_machine.cpu_family() == 'x86_64'
4142
is_subproject = meson.is_subproject()
@@ -75,7 +76,6 @@ global_args = cpp.get_supported_arguments(
7576
'/Gy', # function-level linking
7677
'/GF', # string pooling
7778
'/openmp-',
78-
'/permissive-',
7979
'/utf-8',
8080
'/volatile:iso',
8181
'/Zc:__cplusplus',
@@ -88,6 +88,11 @@ if has_exceptions
8888
else
8989
global_args += cpp.get_supported_arguments('-D_HAS_EXCEPTIONS=0')
9090
endif
91+
if is_permissive
92+
global_args += cpp.get_supported_arguments('/permissive', '-DTOML_DISABLE_CONDITIONAL_NOEXCEPT_LAMBDA=1')
93+
else
94+
global_args += cpp.get_supported_arguments('/permissive-')
95+
endif
9196
if is_pedantic
9297
global_args += cpp.get_supported_arguments(
9398
# clang

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ option('build_examples', type: 'boolean', value: false, description: 'Build the
44
option('build_tests', type: 'boolean', value: false, description: 'Build tests (default: false) (implied by devel)')
55
option('build_tt', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder and decoder. (default: false) (implied by devel) (disabled by unreleased_features)')
66
option('pedantic', type: 'boolean', value: false, description: 'Enable as many compiler warnings as possible (default: false) (implied by devel)')
7+
option('permissive', type: 'boolean', value: false, description: 'Add compiler option /permissive (default: false, which implies /permissive-) (only relevant for MSVC)')
78
option('time_trace', type: 'boolean', value: false, description: 'Enable the -ftime-trace option (Clang only)')
89
option('unreleased_features', type: 'boolean', value: false, description: 'Enable TOML_UNRELEASED_FEATURES=1 (default: false) (only relevant when compiling the library)')
910

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Release|x64">
5+
<Configuration>Release</Configuration>
6+
<Platform>x64</Platform>
7+
</ProjectConfiguration>
8+
</ItemGroup>
9+
<PropertyGroup Label="Globals">
10+
<VCProjectVersion>16.0</VCProjectVersion>
11+
<ProjectGuid>{D318404F-B9AB-4CFB-AEF1-92CE23369837}</ProjectGuid>
12+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
13+
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
14+
</PropertyGroup>
15+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
17+
<ConfigurationType>Application</ConfigurationType>
18+
<UseDebugLibraries>true</UseDebugLibraries>
19+
<PlatformToolset>v143</PlatformToolset>
20+
<CharacterSet>MultiByte</CharacterSet>
21+
</PropertyGroup>
22+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
23+
<ConfigurationType>Application</ConfigurationType>
24+
<UseDebugLibraries>false</UseDebugLibraries>
25+
<PlatformToolset>v143</PlatformToolset>
26+
<WholeProgramOptimization>true</WholeProgramOptimization>
27+
<CharacterSet>MultiByte</CharacterSet>
28+
</PropertyGroup>
29+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
30+
<ImportGroup Label="PropertySheets">
31+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
32+
Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
33+
</ImportGroup>
34+
<Import Project="../../toml++.props" />
35+
<ItemDefinitionGroup>
36+
<ClCompile>
37+
<AdditionalIncludeDirectories>..\tests;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
38+
<ExceptionHandling>Sync</ExceptionHandling>
39+
<PrecompiledHeader>Use</PrecompiledHeader>
40+
<PrecompiledHeaderFile>tests.hpp</PrecompiledHeaderFile>
41+
<PreprocessorDefinitions>TOML_ENABLE_UNRELEASED_FEATURES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
42+
<PreprocessorDefinitions>LEAK_TESTS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
43+
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">_HAS_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
44+
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'=='false'">SHOULD_HAVE_EXCEPTIONS=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
45+
<PreprocessorDefinitions Condition="'%(ExceptionHandling)'!='false'">SHOULD_HAVE_EXCEPTIONS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
46+
<LanguageStandard>stdcpp17</LanguageStandard>
47+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
48+
<WarningLevel>EnableAllWarnings</WarningLevel>
49+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4127</DisableSpecificWarnings> <!-- conditional expr is constant -->
50+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4324</DisableSpecificWarnings> <!-- structure was padded due to alignment specifier -->
51+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4464</DisableSpecificWarnings> <!-- relative include path contains '..' -->
52+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4505</DisableSpecificWarnings> <!-- unreferenced local function removed -->
53+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4514</DisableSpecificWarnings> <!-- unreferenced inline function has been removed -->
54+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4577</DisableSpecificWarnings> <!-- 'noexcept' used with no exception handling mode specified -->
55+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4582</DisableSpecificWarnings> <!-- constructor is not implicitly called -->
56+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4623</DisableSpecificWarnings> <!-- default constructor was implicitly defined as deleted -->
57+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4625</DisableSpecificWarnings> <!-- copy constructor was implicitly defined as deleted -->
58+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4626</DisableSpecificWarnings> <!-- assignment operator was implicitly defined as deleted -->
59+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4710</DisableSpecificWarnings> <!-- function not inlined -->
60+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4711</DisableSpecificWarnings> <!-- function selected for automatic expansion -->
61+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4738</DisableSpecificWarnings> <!-- storing 32-bit float result in memory -->
62+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4820</DisableSpecificWarnings> <!-- N bytes padding added -->
63+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4866</DisableSpecificWarnings> <!-- compiler may not enforce ltr eval in operator[] -->
64+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4868</DisableSpecificWarnings> <!-- compiler may not enforce ltr eval in initializer list -->
65+
<DisableSpecificWarnings>%(DisableSpecificWarnings);4946</DisableSpecificWarnings> <!-- reinterpret_cast used between related classes -->
66+
<DisableSpecificWarnings>%(DisableSpecificWarnings);5026</DisableSpecificWarnings> <!-- move constructor was implicitly defined as deleted -->
67+
<DisableSpecificWarnings>%(DisableSpecificWarnings);5027</DisableSpecificWarnings> <!-- move assignment operator was implicitly defined as deleted -->
68+
<DisableSpecificWarnings>%(DisableSpecificWarnings);5039</DisableSpecificWarnings> <!-- potentially throwing function passed to 'extern "C"' -->
69+
<DisableSpecificWarnings>%(DisableSpecificWarnings);5045</DisableSpecificWarnings> <!-- Compiler will insert Spectre mitigation -->
70+
<ConformanceMode>Default</ConformanceMode> <!-- Default Conformance Mode implies using the legacy lambda processor -->
71+
</ClCompile>
72+
</ItemDefinitionGroup>
73+
<PropertyGroup>
74+
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\</LocalDebuggerWorkingDirectory>
75+
</PropertyGroup>
76+
<ItemGroup>
77+
<ClCompile Include="..\at_path.cpp" />
78+
<ClCompile Include="..\path.cpp" />
79+
<ClCompile Include="..\conformance_burntsushi_invalid.cpp" />
80+
<ClCompile Include="..\conformance_burntsushi_valid.cpp" />
81+
<ClCompile Include="..\conformance_iarna_invalid.cpp" />
82+
<ClCompile Include="..\conformance_iarna_valid.cpp" />
83+
<ClCompile Include="..\for_each.cpp" />
84+
<ClCompile Include="..\formatters.cpp" />
85+
<ClCompile Include="..\impl_toml.cpp">
86+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
87+
</ClCompile>
88+
<ClCompile Include="..\main.cpp">
89+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
90+
</ClCompile>
91+
<ClCompile Include="..\manipulating_arrays.cpp" />
92+
<ClCompile Include="..\manipulating_tables.cpp" />
93+
<ClCompile Include="..\manipulating_parse_result.cpp" />
94+
<ClCompile Include="..\manipulating_values.cpp" />
95+
<ClCompile Include="..\parsing_arrays.cpp" />
96+
<ClCompile Include="..\parsing_booleans.cpp" />
97+
<ClCompile Include="..\parsing_comments.cpp" />
98+
<ClCompile Include="..\parsing_dates_and_times.cpp" />
99+
<ClCompile Include="..\parsing_floats.cpp" />
100+
<ClCompile Include="..\parsing_integers.cpp" />
101+
<ClCompile Include="..\parsing_key_value_pairs.cpp" />
102+
<ClCompile Include="..\parsing_spec_example.cpp" />
103+
<ClCompile Include="..\parsing_strings.cpp" />
104+
<ClCompile Include="..\parsing_tables.cpp" />
105+
<ClCompile Include="..\tests.cpp">
106+
<PrecompiledHeader>Create</PrecompiledHeader>
107+
</ClCompile>
108+
<ClCompile Include="..\user_feedback.cpp" />
109+
<ClCompile Include="..\using_iterators.cpp" />
110+
<ClCompile Include="..\visit.cpp" />
111+
<ClCompile Include="..\windows_compat.cpp" />
112+
</ItemGroup>
113+
<ItemGroup>
114+
<Natvis Include="..\..\toml++.natvis" />
115+
</ItemGroup>
116+
<ItemGroup>
117+
<ClInclude Include="..\leakproof.hpp" />
118+
<ClInclude Include="..\lib_catch2.hpp" />
119+
<ClInclude Include="..\lib_tloptional.hpp" />
120+
<ClInclude Include="..\settings.hpp" />
121+
<ClInclude Include="..\tests.hpp" />
122+
</ItemGroup>
123+
<ItemGroup>
124+
<None Include="..\cpp.hint" />
125+
<None Include="..\meson.build" />
126+
</ItemGroup>
127+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
128+
</Project>

toml++.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_release_x64_cpplatest_
5959
EndProject
6060
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_release_x64_cpplatest_unrel", "tests\vs\test_release_x64_cpplatest_unrel.vcxproj", "{74813AFD-DB22-52FA-9108-0BADD4B0E161}"
6161
EndProject
62+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_release_x64_legacy_lambda", "tests\vs\test_release_x64_legacy_lambda.vcxproj", "{D318404F-B9AB-4CFB-AEF1-92CE23369837}"
63+
EndProject
6264
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_release_x64_noexcept", "tests\vs\test_release_x64_noexcept.vcxproj", "{B1B28D93-892C-59BF-9C6F-D813EC6438A0}"
6365
EndProject
6466
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_release_x64_noexcept_unrel", "tests\vs\test_release_x64_noexcept_unrel.vcxproj", "{6C3EA8CD-33CC-5775-ACC4-631FF5FE1E2C}"
@@ -265,6 +267,10 @@ Global
265267
{E467EB97-B066-4D38-B3DB-60961E3F96A1}.Debug|x64.Build.0 = Debug|x64
266268
{E467EB97-B066-4D38-B3DB-60961E3F96A1}.Release|x64.ActiveCfg = Release|x64
267269
{E467EB97-B066-4D38-B3DB-60961E3F96A1}.Release|x64.Build.0 = Release|x64
270+
{D318404F-B9AB-4CFB-AEF1-92CE23369837}.Debug|x64.ActiveCfg = Release|x64
271+
{D318404F-B9AB-4CFB-AEF1-92CE23369837}.Debug|x64.Build.0 = Release|x64
272+
{D318404F-B9AB-4CFB-AEF1-92CE23369837}.Release|x64.ActiveCfg = Release|x64
273+
{D318404F-B9AB-4CFB-AEF1-92CE23369837}.Release|x64.Build.0 = Release|x64
268274
EndGlobalSection
269275
GlobalSection(SolutionProperties) = preSolution
270276
HideSolutionNode = FALSE
@@ -311,6 +317,7 @@ Global
311317
{8F673261-5DFE-4B67-937A-61FC3F0082A2} = {5DE43BF4-4EDD-4A7A-A422-764415BB3224}
312318
{723FC4CA-0E24-4956-8FDC-E537EA3847AA} = {4E25CF88-D7D8-4A9C-A52E-0D78281E82EC}
313319
{E467EB97-B066-4D38-B3DB-60961E3F96A1} = {412816A5-9D22-4A30-BCDF-ABFB54BB3735}
320+
{D318404F-B9AB-4CFB-AEF1-92CE23369837} = {4E25CF88-D7D8-4A9C-A52E-0D78281E82EC}
314321
EndGlobalSection
315322
GlobalSection(ExtensibilityGlobals) = postSolution
316323
SolutionGuid = {0926DDCC-88CD-4839-A82D-D9B99E02A0B1}

0 commit comments

Comments
 (0)