Skip to content

Commit 2a9f40f

Browse files
committed
compilers: make lang_map public
1 parent 4ad792e commit 2a9f40f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

mesonbuild/compilers/detect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ def _get_gnu_compiler_defines(compiler: T.List[str], lang: str) -> T.Dict[str, s
13331333
"""
13341334
Get the list of GCC pre-processor defines
13351335
"""
1336-
from .mixins.gnu import _LANG_MAP as gnu_LANG_MAP
1336+
from .mixins.gnu import gnu_lang_map
13371337

13381338
def _try_obtain_compiler_defines(args: T.List[str]) -> str:
13391339
mlog.debug(f'Running command: {join_args(args)}')
@@ -1355,7 +1355,7 @@ def _try_obtain_compiler_defines(args: T.List[str]) -> str:
13551355

13561356
# We might not have a match for Fortran, so fallback to detection
13571357
# based on the driver.
1358-
lang = gnu_LANG_MAP[lang]
1358+
lang = gnu_lang_map[lang]
13591359

13601360
# The compiler may not infer the target language based on the driver name
13611361
# so first, try with '-cpp -x lang', then fallback without given it's less
@@ -1386,7 +1386,7 @@ def _get_clang_compiler_defines(compiler: T.List[str], lang: str) -> T.Dict[str,
13861386
"""
13871387
Get the list of Clang pre-processor defines
13881388
"""
1389-
from .mixins.clang import _LANG_MAP as clang_LANG_MAP
1389+
from .mixins.clang import clang_lang_map
13901390

13911391
def _try_obtain_compiler_defines(args: T.List[str]) -> str:
13921392
mlog.debug(f'Running command: {join_args(args)}')
@@ -1407,7 +1407,7 @@ def _try_obtain_compiler_defines(args: T.List[str]) -> str:
14071407

14081408
# We might not have a match for Fortran, so fallback to detection
14091409
# based on the driver.
1410-
lang = clang_LANG_MAP[lang]
1410+
lang = clang_lang_map[lang]
14111411

14121412
# The compiler may not infer the target language based on the driver name
14131413
# so first, try with '-cpp -x lang', then fallback without given it's less

mesonbuild/compilers/mixins/clang.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
's': ['-Oz'],
3737
}
3838

39-
_LANG_MAP = {
39+
clang_lang_map = {
4040
'c': 'c',
4141
'cpp': 'c++',
4242
'objc': 'objective-c',

mesonbuild/compilers/mixins/gnu.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
],
310310
}
311311

312-
_LANG_MAP = {
312+
gnu_lang_map = {
313313
'c': 'c',
314314
'cpp': 'c++',
315315
'objc': 'objective-c',
@@ -318,9 +318,9 @@
318318

319319
@functools.lru_cache(maxsize=None)
320320
def gnulike_default_include_dirs(compiler: T.Tuple[str, ...], lang: str) -> 'ImmutableListProtocol[str]':
321-
if lang not in _LANG_MAP:
321+
if lang not in gnu_lang_map:
322322
return []
323-
lang = _LANG_MAP[lang]
323+
lang = gnu_lang_map[lang]
324324
env = os.environ.copy()
325325
env["LC_ALL"] = 'C'
326326
cmd = list(compiler) + [f'-x{lang}', '-E', '-v', '-']
@@ -534,7 +534,7 @@ def get_preprocess_to_file_args(self) -> T.List[str]:
534534
# We want to allow preprocessing files with any extension, such as
535535
# foo.c.in. In that case we need to tell GCC/CLANG to treat them as
536536
# assembly file.
537-
lang = _LANG_MAP.get(self.language, 'assembler-with-cpp')
537+
lang = gnu_lang_map.get(self.language, 'assembler-with-cpp')
538538
return self.get_preprocess_only_args() + [f'-x{lang}']
539539

540540

0 commit comments

Comments
 (0)