Skip to content

Commit f6fef68

Browse files
authored
CXX-3253 reintroduce VS 2015 task coverage (#1381)
* Fix compiler selection via expansions and environment variables * Workaround -Wmaybe-uninitialized warnings for {}-initialized optional<T> * Fix USE_STATIC_LIBS conditional * Remove obsoleted -Wno-aligned-new flag * GCC 4 and GCC 5 do not have -Wignored-attributes * CXX-3241 suppress more hedged reads deprecation warnings * Address -Walign-mismatch warnings due to type deduction * Update compile-only matrix to extend compiler and standard coverage
1 parent 14e3f0d commit f6fef68

File tree

23 files changed

+951
-1109
lines changed

23 files changed

+951
-1109
lines changed

.evergreen/config_generator/components/compile_only.py

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,62 @@
99
from shrub.v3.evg_command import KeyValueParam, expansions_update
1010
from shrub.v3.evg_task import EvgTask, EvgTaskRef
1111

12-
from itertools import product
13-
1412

1513
TAG = 'compile-only'
1614

1715

1816
# pylint: disable=line-too-long
1917
# fmt: off
2018
MATRIX = [
21-
('rhel80', 'gcc', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, 23]),
22-
('rhel80', 'clang', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, 23]),
23-
24-
('ubuntu2004-arm64', 'gcc', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, 23]),
25-
('ubuntu2004-arm64', 'clang', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, 23]),
26-
27-
('rhel8-power', None, ['Debug', 'Release'], ['shared', 'static'], [11, 17]),
28-
('rhel8-zseries', None, ['Debug', 'Release'], ['shared', 'static'], [11, 17]),
29-
30-
('macos-14-arm64', None, ['Debug', 'Release'], ['shared', 'static'], [11, 17]),
31-
('macos-14', None, ['Debug', 'Release'], ['shared', 'static'], [11, 17]),
32-
33-
('windows-vsCurrent', 'vs2017x64', ['Debug', 'Release'], ['shared', 'static'], [11, 17, ]),
34-
('windows-vsCurrent', 'vs2019x64', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, ]),
35-
('windows-vsCurrent', 'vs2022x64', ['Debug', 'Release'], ['shared', 'static'], [11, 17, 20, 23]),
19+
# C++ standard and compiler coverage
20+
21+
('rhel80', 'clang', [11, 17, 20, ]), # Clang 7.0 (max: C++20)
22+
('ubuntu2004', 'clang-10', [11, 17, 20, ]), # Clang 10.0 (max: C++20)
23+
('rhel84', 'clang', [11, 17, 20, ]), # Clang 11.0 (max: C++20)
24+
('ubuntu2204', 'clang-12', [11, 17, 20, 23]), # Clang 12.0 (max: C++23)
25+
('rhel90', 'clang', [11, 17, 20, 23]), # Clang 13.0 (max: C++23)
26+
('rhel91', 'clang', [11, 17, 20, 23]), # Clang 14.0 (max: C++23)
27+
('rhel92', 'clang', [11, 17, 20, 23]), # Clang 15.0 (max: C++23)
28+
('rhel93', 'clang', [11, 17, 20, 23]), # Clang 16.0 (max: C++23)
29+
('rhel94', 'clang', [11, 17, 20, 23]), # Clang 17.0 (max: C++23)
30+
('rhel95', 'clang', [11, 17, 20, 23]), # Clang 18.0 (max: C++23)
31+
32+
('rhel76', 'gcc', [11, 14, ]), # GCC 4.8 (max: C++14)
33+
('rhel80', 'gcc', [11, 17, 20, ]), # GCC 8.2 (max: C++20)
34+
('debian10', 'gcc-8', [11, 17, 20, ]), # GCC 8.3 (max: C++20)
35+
('rhel84', 'gcc', [11, 17, 20, ]), # GCC 8.4 (max: C++20)
36+
('ubuntu2004', 'gcc-9', [11, 17, 20, ]), # GCC 9.4 (max: C++20)
37+
('debian11', 'gcc-10', [11, 17, 20, ]), # GCC 10.2 (max: C++20)
38+
('rhel90', 'gcc', [11, 17, 20, 23]), # GCC 11.2 (max: C++23)
39+
('rhel92', 'gcc', [11, 17, 20, 23]), # GCC 11.3 (max: C++23)
40+
('rhel94', 'gcc', [11, 17, 20, 23]), # GCC 11.4 (max: C++23)
41+
('rhel95', 'gcc', [11, 17, 20, 23]), # GCC 11.5 (max: C++23)
42+
43+
('windows-vsCurrent', 'vs2015x64', [11, 14, 'latest']), # Max: C++14
44+
('windows-vsCurrent', 'vs2017x64', [11, 14, 17, 20, 'latest']), # Max: C++20
45+
('windows-vsCurrent', 'vs2019x64', [11, 14, 17, 20, 23, 'latest']), # Max: C++23
46+
('windows-vsCurrent', 'vs2022x64', [11, 14, 17, 20, 23, 'latest']), # Max: C++23
47+
48+
# Other coverage.
49+
50+
('ubuntu2004-arm64', 'gcc', [11, 17]), # Clang 10
51+
('ubuntu2004-arm64', 'clang', [11, 17]), # Clang 10
52+
53+
('rhel8-power', None, [11, 17]),
54+
('rhel8-zseries', None, [11, 17]),
55+
56+
('macos-14-arm64', None, [11, 17]),
57+
('macos-14', None, [11, 17]),
3658
]
3759
# fmt: on
3860
# pylint: enable=line-too-long
3961

4062

4163
def tasks():
42-
for distro_name, compiler, build_types, link_types, cxx_standards in MATRIX:
43-
for build_type, link_type, cxx_standard in product(build_types, link_types, cxx_standards):
64+
build_type = 'Debug'
65+
66+
for distro_name, compiler, cxx_standards in MATRIX:
67+
for cxx_standard in cxx_standards:
4468
distro = find_large_distro(distro_name)
4569

4670
name = f'{TAG}-{make_distro_str(distro_name, compiler, None)}'
@@ -53,21 +77,18 @@ def tasks():
5377
if compiler is not None:
5478
tags.append(compiler)
5579

56-
name += f'-{build_type.lower()}-{link_type}'
57-
tags += [build_type.lower(), link_type]
80+
name += f'-{build_type.lower()}'
81+
tags += [build_type.lower()]
5882

5983
updates = []
60-
compile_vars = {}
84+
compile_vars = {'BUILD_SHARED_AND_STATIC_LIBS': 'ON'}
6185

6286
updates += [KeyValueParam(key='build_type', value=build_type)]
6387
updates += [KeyValueParam(key=key, value=value) for key, value in compiler_to_vars(compiler).items()]
6488

6589
if cxx_standard is not None:
6690
compile_vars |= {'REQUIRED_CXX_STANDARD': cxx_standard}
6791

68-
if link_type == 'static':
69-
compile_vars |= {'USE_STATIC_LIBS': 1}
70-
7192
# PowerPC and zSeries are limited resources.
7293
patchable = False if any(pattern in distro_name for pattern in ['power', 'zseries']) else None
7394

@@ -79,6 +100,7 @@ def tasks():
79100
Compile.call(
80101
build_type=build_type,
81102
compiler=compiler,
103+
vars=compile_vars,
82104
)
83105
]
84106

.evergreen/config_generator/components/funcs/install_c_driver.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ class InstallCDriver(Function):
2929
bash_exec(
3030
command_type=EvgCommandType.SETUP,
3131
add_expansions_to_env=True,
32+
env={
33+
'CC': '${cc_compiler}',
34+
'CXX': '${cxx_compiler}',
35+
},
3236
script='mongo-cxx-driver/.evergreen/scripts/install-c-driver.sh'
3337
),
3438
]

.evergreen/config_generator/etc/distros.py

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class Distro(BaseModel):
2222
os_type: Literal['linux', 'macos', 'windows'] | None = None
2323
os_ver: str | None = None
2424
vs_ver: Literal[
25-
'2013',
2625
'2015',
2726
'2017',
2827
'2019',
@@ -48,6 +47,8 @@ def ls_distro(name, **kwargs):
4847

4948

5049
DEBIAN_DISTROS = [
50+
*ls_distro(name='debian10', os='debian', os_type='linux', os_ver='10'),
51+
*ls_distro(name='debian11', os='debian', os_type='linux', os_ver='10'),
5152
*ls_distro(name='debian12-latest', os='debian', os_type='linux', os_ver='latest'),
5253
]
5354

@@ -60,8 +61,16 @@ def ls_distro(name, **kwargs):
6061
]
6162

6263
RHEL_DISTROS = [
64+
*ls_distro(name='rhel76', os='rhel', os_type='linux', os_ver='7.6'),
6365
*ls_distro(name='rhel80', os='rhel', os_type='linux', os_ver='8.0'),
66+
*ls_distro(name='rhel84', os='rhel', os_type='linux', os_ver='8.4'),
67+
*ls_distro(name='rhel90', os='rhel', os_type='linux', os_ver='9.0'),
68+
*ls_distro(name='rhel91', os='rhel', os_type='linux', os_ver='9.1'),
69+
*ls_distro(name='rhel92', os='rhel', os_type='linux', os_ver='9.2'),
70+
*ls_distro(name='rhel93', os='rhel', os_type='linux', os_ver='9.3'),
71+
*ls_distro(name='rhel94', os='rhel', os_type='linux', os_ver='9.4'),
6472
*ls_distro(name='rhel95', os='rhel', os_type='linux', os_ver='9.5'),
73+
*ls_distro(name='rhel92', os='rhel', os_type='linux', os_ver='9.0'),
6574
]
6675

6776
RHEL_ARM64_DISTROS = [
@@ -78,6 +87,7 @@ def ls_distro(name, **kwargs):
7887
]
7988

8089
UBUNTU_DISTROS = [
90+
*ls_distro(name='ubuntu2004', os='ubuntu', os_type='linux', os_ver='20.04'),
8191
*ls_distro(name='ubuntu2204', os='ubuntu', os_type='linux', os_ver='22.04'),
8292
]
8393

@@ -151,19 +161,6 @@ def make_distro_str(distro_name, compiler, arch) -> str:
151161
distro_name[len('windows-vsCurrent-'):] + f'-{compiler_str}'
152162
else:
153163
distro_str = 'windows-2019' + f'-{compiler_str}'
154-
elif distro_name.startswith('windows-64-vs'):
155-
# Abbreviate 'windows-64-vs<type>' as 'vs<type>' and append '-<arch>' if
156-
# given in compiler string as 'vs<type><arch>', e.g.:
157-
# ('windows-64-vs2017', 'vs2017x64', None) -> vs2017-x64
158-
# ('windows-64-vs2017', 'mingw', None) -> vs2017-mingw
159-
distro_str = distro_name[len('windows-64-'):] + {
160-
'vs2017x64': '-x64',
161-
'vs2017x86': '-x86',
162-
'vs2019x64': '-x64',
163-
'vs2019x86': '-x86',
164-
'vs2022x64': '-x64',
165-
'vs2022x86': '-x86',
166-
}.get(compiler, f'-{compiler}')
167164
else:
168165
distro_str = distro_name
169166
if compiler:
@@ -177,6 +174,8 @@ def make_distro_str(distro_name, compiler, arch) -> str:
177174

178175
def to_cc(compiler):
179176
return {
177+
'vs2015x64': 'Visual Studio 14 2015',
178+
'vs2015x86': 'Visual Studio 14 2015',
180179
'vs2017x64': 'Visual Studio 15 2017',
181180
'vs2017x86': 'Visual Studio 15 2017',
182181
'vs2019x64': 'Visual Studio 16 2019',
@@ -188,6 +187,8 @@ def to_cc(compiler):
188187

189188
def to_platform(compiler):
190189
return {
190+
'vs2015x64': 'x64',
191+
'vs2015x86': 'Win32',
191192
'vs2017x64': 'x64',
192193
'vs2017x86': 'Win32',
193194
'vs2019x64': 'x64',
@@ -198,24 +199,30 @@ def to_platform(compiler):
198199

199200

200201
def compiler_to_vars(compiler):
201-
match compiler:
202-
case 'gcc':
202+
if compiler is None:
203+
return {}
204+
205+
match compiler, compiler.split('-'):
206+
case _, ['gcc', *rest]:
203207
return {
204-
'cc_compiler': 'gcc',
205-
'cxx_compiler': 'g++',
208+
'cc_compiler': '-'.join(['gcc'] + rest),
209+
'cxx_compiler': '-'.join(['g++'] + rest),
206210
}
207211

208-
case 'clang':
212+
case _, ['clang', *rest]:
209213
return {
210-
'cc_compiler': 'clang',
211-
'cxx_compiler': 'clang++',
214+
'cc_compiler': '-'.join(['clang'] + rest),
215+
'cxx_compiler': '-'.join(['clang++'] + rest),
212216
}
213217

214-
case str(vs) if 'vs' in vs:
218+
case str(vs), _ if 'vs' in vs:
215219
return {
216220
'generator': to_cc(vs),
217221
'platform': to_platform(vs),
218222
}
219223

220-
case _:
221-
return {}
224+
case compiler, _:
225+
return {
226+
'cc_compiler': compiler,
227+
'cxx_compiler': compiler,
228+
}

.evergreen/generated_configs/functions.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ functions:
493493
params:
494494
binary: bash
495495
add_expansions_to_env: true
496+
env:
497+
CC: ${cc_compiler}
498+
CXX: ${cxx_compiler}
496499
args:
497500
- -c
498501
- mongo-cxx-driver/.evergreen/scripts/install-c-driver.sh

0 commit comments

Comments
 (0)