diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-10-13 10:09:38 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-11-12 10:03:15 -0800 |
commit | 2844afedde3992564e0de4538b29781a420f8576 (patch) | |
tree | dc49820b752efede769477e81dac18023fd4928c /mesonbuild/compilers/fortran.py | |
parent | a28a34c6845144d2e947bd698244fb33909b4d45 (diff) | |
download | meson-2844afedde3992564e0de4538b29781a420f8576.tar.gz |
compilers: define standards in the base language compiler
And then update the choices in each leaf class. This way we don't end up
with another case where we implicitly allow an invalid standard to be
set on a compiler that doesn't have a 'std' setting currently.
Diffstat (limited to 'mesonbuild/compilers/fortran.py')
-rw-r--r-- | mesonbuild/compilers/fortran.py | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index e85ee6d28..036369a73 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -150,6 +150,17 @@ class FortranCompiler(CLikeCompiler, Compiler): def has_multi_link_arguments(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]: return self._has_multi_link_arguments(args, env, 'stop; end program') + def get_options(self) -> 'OptionDictType': + opts = super().get_options() + opts.update({ + 'std': coredata.UserComboOption( + 'Fortran language standard to use', + ['none'], + 'none', + ), + }) + return opts + class GnuFortranCompiler(GnuCompiler, FortranCompiler): @@ -175,13 +186,7 @@ class GnuFortranCompiler(GnuCompiler, FortranCompiler): fortran_stds += ['f2008'] if version_compare(self.version, '>=8.0.0'): fortran_stds += ['f2018'] - opts.update({ - 'std': coredata.UserComboOption( - 'Fortran language standard to use', - ['none'] + fortran_stds, - 'none', - ), - }) + opts['std'].choices = ['none'] + fortran_stds # type: ignore return opts def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]: @@ -310,14 +315,7 @@ class IntelFortranCompiler(IntelGnuLikeCompiler, FortranCompiler): def get_options(self) -> 'OptionDictType': opts = FortranCompiler.get_options(self) - fortran_stds = ['legacy', 'f95', 'f2003', 'f2008', 'f2018'] - opts.update({ - 'std': coredata.UserComboOption( - 'Fortran language standard to use', - ['none'] + fortran_stds, - 'none', - ), - }) + opts['std'].choices = ['legacy', 'f95', 'f2003', 'f2008', 'f2018'] # type: ignore return opts def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]: @@ -367,14 +365,7 @@ class IntelClFortranCompiler(IntelVisualStudioLikeCompiler, FortranCompiler): def get_options(self) -> 'OptionDictType': opts = FortranCompiler.get_options(self) - fortran_stds = ['legacy', 'f95', 'f2003', 'f2008', 'f2018'] - opts.update({ - 'std': coredata.UserComboOption( - 'Fortran language standard to use', - ['none'] + fortran_stds, - 'none', - ), - }) + opts['std'].choices = ['legacy', 'f95', 'f2003', 'f2008', 'f2018'] # type: ignore return opts def get_option_compile_args(self, options: 'OptionDictType') -> T.List[str]: |