Skip to content

Commit

Permalink
Add options for standard parameter for nvc and nvc++
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmeagher committed Jul 24, 2024
1 parent f009ccb commit c686d09
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mesonbuild/compilers/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_
info, linker=linker, full_version=full_version)
PGICompiler.__init__(self)

def get_options(self) -> 'MutableKeyedOptionDictType':
opts = CCompiler.get_options(self)
cppstd_choices = ['c89', 'c90', 'c99', 'c11', 'c17', 'c18']
std_opt = opts[self.form_langopt_key('std')]
assert isinstance(std_opt, options.UserStdOption), 'for mypy'
std_opt.set_versions(cppstd_choices, gnu=True)
return opts


class ElbrusCCompiler(ElbrusCompiler, CCompiler):
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
Expand Down
11 changes: 11 additions & 0 deletions mesonbuild/compilers/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,17 @@ def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_
info, linker=linker, full_version=full_version)
PGICompiler.__init__(self)

def get_options(self) -> 'MutableKeyedOptionDictType':
opts = CPPCompiler.get_options(self)
cppstd_choices = [
'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++23',
'gnu++98', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++20'
]
std_opt = opts[self.form_langopt_key('std')]
assert isinstance(std_opt, options.UserStdOption), 'for mypy'
std_opt.set_versions(cppstd_choices)
return opts


class ElbrusCPPCompiler(ElbrusCompiler, CPPCompiler):
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, is_cross: bool,
Expand Down

0 comments on commit c686d09

Please sign in to comment.