optinterpreter: Remove duplicated list of languages

It is important to keep the list of languages up to date in
optinterpreter, otherwise we could have conflicting options when adding
new languages.
pull/3705/head
Xavier Claessens 7 years ago committed by Nirbheek Chauhan
parent aa879b7f0c
commit 218ed2de89
  1. 2
      mesonbuild/compilers/__init__.py
  2. 1
      mesonbuild/compilers/compilers.py
  3. 15
      mesonbuild/optinterpreter.py

@ -25,6 +25,7 @@ __all__ = [
'ICC_STANDARD', 'ICC_STANDARD',
'ICC_WIN', 'ICC_WIN',
'all_languages',
'base_options', 'base_options',
'clike_langs', 'clike_langs',
'c_suffixes', 'c_suffixes',
@ -99,6 +100,7 @@ from .compilers import (
ICC_OSX, ICC_OSX,
ICC_WIN, ICC_WIN,
ICC_STANDARD, ICC_STANDARD,
all_languages,
base_options, base_options,
clike_langs, clike_langs,
c_suffixes, c_suffixes,

@ -45,6 +45,7 @@ lang_suffixes = {
'swift': ('swift',), 'swift': ('swift',),
'java': ('java',), 'java': ('java',),
} }
all_languages = lang_suffixes.keys()
cpp_suffixes = lang_suffixes['cpp'] + ('h',) cpp_suffixes = lang_suffixes['cpp'] + ('h',)
c_suffixes = lang_suffixes['c'] + ('h',) c_suffixes = lang_suffixes['c'] + ('h',)
# List of languages that can be linked with C code directly by the linker # List of languages that can be linked with C code directly by the linker

@ -20,21 +20,10 @@ from . import mparser
from . import coredata from . import coredata
from . import mesonlib from . import mesonlib
from .interpreterbase import FeatureNew from .interpreterbase import FeatureNew
from . import compilers
forbidden_option_names = coredata.get_builtin_options() forbidden_option_names = coredata.get_builtin_options()
forbidden_prefixes = {'c_', forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
'cpp_',
'd_',
'rust_',
'fortran_',
'objc_',
'objcpp_',
'vala_',
'csharp_',
'swift_',
'b_',
'backend_',
}
def is_invalid_name(name): def is_invalid_name(name):
if name in forbidden_option_names: if name in forbidden_option_names:

Loading…
Cancel
Save