Skip to content

Commit 002982b

Browse files
tychonirbheek
authored andcommitted
c++: add support for c++23 standard and aliases
GCC 12.3 and Clang 16 support -std flags for c++23/c++2b. Signed-off-by: Steven Noonan <[email protected]> Signed-off-by: Patrick Williams <[email protected]> Backported-by: Nirbheek Chauhan <[email protected]>
1 parent 5c1b0ef commit 002982b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mesonbuild/compilers/cpp.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ def language_stdlib_only_link_flags(self, env: Environment) -> T.List[str]:
224224

225225

226226
class ClangCPPCompiler(_StdCPPLibMixin, ClangCompiler, CPPCompiler):
227+
228+
_CPP23_VERSION = '>=12.0.0'
229+
227230
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
228231
info: 'MachineInfo', exe_wrapper: T.Optional['ExternalProgram'] = None,
229232
linker: T.Optional['DynamicLinker'] = None,
@@ -250,11 +253,15 @@ def get_options(self) -> 'MutableKeyedOptionDictType':
250253
),
251254
key.evolve('rtti'): coredata.UserBooleanOption('Enable RTTI', True),
252255
})
253-
opts[key.evolve('std')].choices = [
256+
cppstd_choices = [
254257
'none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
255258
'c++2a', 'c++20', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z',
256259
'gnu++2a', 'gnu++20',
257260
]
261+
if version_compare(self.version, self._CPP23_VERSION):
262+
cppstd_choices.append('c++23')
263+
cppstd_choices.append('gnu++23')
264+
opts[key.evolve('std')].choices = cppstd_choices
258265
if self.info.is_windows() or self.info.is_cygwin():
259266
opts.update({
260267
key.evolve('winlibs'): coredata.UserArrayOption(
@@ -296,7 +303,8 @@ class ArmLtdClangCPPCompiler(ClangCPPCompiler):
296303

297304

298305
class AppleClangCPPCompiler(ClangCPPCompiler):
299-
pass
306+
307+
_CPP23_VERSION = '>=13.0.0'
300308

301309

302310
class EmscriptenCPPCompiler(EmscriptenMixin, ClangCPPCompiler):

0 commit comments

Comments
 (0)