From 8236bed11b03c46508227dd4f9490482453c7959 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Feb 2018 16:53:15 +0300 Subject: Support lcc compiler for e2k (Elbrus) architecture --- mesonbuild/environment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index e553423..ab3bfc9 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -498,7 +498,7 @@ class Environment: continue version = search_version(out) full_version = out.split('\n', 1)[0] - if 'Free Software Foundation' in out: + if 'Free Software Foundation' or ('e2k' and 'lcc') in out: defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' @@ -611,7 +611,7 @@ class Environment: popen_exceptions[' '.join(compiler + arg)] = e continue version = search_version(out) - if 'Free Software Foundation' in out: + if 'Free Software Foundation' or ('e2k' and 'lcc') in out: defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' @@ -638,7 +638,7 @@ class Environment: popen_exceptions[' '.join(compiler + arg)] = e continue version = search_version(out) - if 'Free Software Foundation' in out: + if 'Free Software Foundation' or ('e2k' and 'lcc') in out: defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' -- cgit v1.1 From 22a83817c8685733adaa94c21b9b248b3e62f5f8 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Feb 2018 18:29:25 +0300 Subject: Fixed syntax issues (for 'in' operator) --- mesonbuild/environment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index ab3bfc9..b3b4a55 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -498,7 +498,7 @@ class Environment: continue version = search_version(out) full_version = out.split('\n', 1)[0] - if 'Free Software Foundation' or ('e2k' and 'lcc') in out: + if 'Free Software Foundation' in out or ('e2k' in out and 'lcc' in out): defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' @@ -611,7 +611,7 @@ class Environment: popen_exceptions[' '.join(compiler + arg)] = e continue version = search_version(out) - if 'Free Software Foundation' or ('e2k' and 'lcc') in out: + if 'Free Software Foundation' in out or ('e2k' in out and 'lcc' in out): defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' @@ -638,7 +638,7 @@ class Environment: popen_exceptions[' '.join(compiler + arg)] = e continue version = search_version(out) - if 'Free Software Foundation' or ('e2k' and 'lcc') in out: + if 'Free Software Foundation' in out or ('e2k' in out and 'lcc' in out): defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' -- cgit v1.1 From 7cc41baa98e486d6fd08ca5bb6f336481b757c4a Mon Sep 17 00:00:00 2001 From: makise-homura Date: Mon, 19 Mar 2018 23:30:00 +0300 Subject: Added Elbrus lcc compilers support as inheritance from gcc ones --- mesonbuild/compilers/__init__.py | 6 ++++++ mesonbuild/compilers/c.py | 16 ++++++++++++++++ mesonbuild/compilers/compilers.py | 11 +++++++++++ mesonbuild/compilers/cpp.py | 16 ++++++++++++++++ mesonbuild/compilers/fortran.py | 7 +++++++ mesonbuild/environment.py | 30 +++++++++++++++++++++++++++--- mesonbuild/modules/rpm.py | 7 +++++++ 7 files changed, 90 insertions(+), 3 deletions(-) diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py index f09f252..1679243 100644 --- a/mesonbuild/compilers/__init__.py +++ b/mesonbuild/compilers/__init__.py @@ -54,10 +54,13 @@ __all__ = [ 'FortranCompiler', 'G95FortranCompiler', 'GnuCCompiler', + 'ElbrusCCompiler', 'GnuCompiler', 'GnuCPPCompiler', + 'ElbrusCPPCompiler', 'GnuDCompiler', 'GnuFortranCompiler', + 'ElbrusFortranCompiler', 'GnuObjCCompiler', 'GnuObjCPPCompiler', 'IntelCompiler', @@ -117,6 +120,7 @@ from .c import ( CCompiler, ClangCCompiler, GnuCCompiler, + ElbrusCCompiler, IntelCCompiler, VisualStudioCCompiler, ) @@ -124,6 +128,7 @@ from .cpp import ( CPPCompiler, ClangCPPCompiler, GnuCPPCompiler, + ElbrusCPPCompiler, IntelCPPCompiler, VisualStudioCPPCompiler, ) @@ -138,6 +143,7 @@ from .fortran import ( FortranCompiler, G95FortranCompiler, GnuFortranCompiler, + ElbrusFortranCompiler, IntelFortranCompiler, NAGFortranCompiler, Open64FortranCompiler, diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 1c9b9b4..be8bb52 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -36,6 +36,7 @@ from .compilers import ( CompilerArgs, CrossNoRunException, GnuCompiler, + ElbrusCompiler, IntelCompiler, RunResult, ) @@ -888,6 +889,21 @@ class GnuCCompiler(GnuCompiler, CCompiler): return ['-fpch-preprocess', '-include', os.path.basename(header)] +class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuCCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, gcc_type, defines) + + # It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports. + def get_options(self): + opts = {'c_std': coredata.UserComboOption('c_std', 'C language standard to use', + ['none', 'c89', 'c90', 'c9x', 'c99', 'c1x', 'c11', + 'gnu89', 'gnu90', 'gnu9x', 'gnu99', 'gnu1x', 'gnu11', + 'iso9899:2011', 'iso9899:1990', 'iso9899:199409', 'iso9899:1999'], + 'none')} + return opts + + class IntelCCompiler(IntelCompiler, CCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwargs) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 034fef4..0ab9b49 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1076,6 +1076,17 @@ class GnuCompiler: return gnulike_default_include_dirs(self.exelist, self.language) +class ElbrusCompiler(GnuCompiler): + # Elbrus compiler is nearly like GCC, but does not support + # PCH, LTO, sanitizers and color output as of version 1.21.x. + def __init__(self, gcc_type, defines): + GnuCompiler.__init__(self, gcc_type, defines) + self.id = 'lcc' + self.base_options = ['b_pgo', 'b_coverage', + 'b_ndebug', 'b_staticpic', + 'b_lundef', 'b_asneeded' ] + + class ClangCompiler: def __init__(self, clang_type): self.id = 'clang' diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index c10f38e..fd09e46 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -25,6 +25,7 @@ from .compilers import ( msvc_winlibs, ClangCompiler, GnuCompiler, + ElbrusCompiler, IntelCompiler, ) @@ -133,6 +134,21 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): return ['-fpch-preprocess', '-include', os.path.basename(header)] +class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuCPPCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, gcc_type, defines) + + # It does not support c++/gnu++ 17 and 1z, but still does support 0x, 1y, and gnu++98. + def get_options(self): + opts = super().get_options() + opts['cpp_std'] = coredata.UserComboOption('cpp_std', 'C++ language standard to use', + ['none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y', + 'gnu++98', 'gnu++03', 'gnu++0x', 'gnu++11', 'gnu++14', 'gnu++1y'], + 'none') + return opts + + class IntelCPPCompiler(IntelCompiler, CPPCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap, **kwargs) diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index f9fcc1c..e61c976 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -27,6 +27,7 @@ from .compilers import ( gnulike_buildtype_args, gnulike_buildtype_linker_args, Compiler, + ElbrusCompiler, IntelCompiler, ) @@ -180,6 +181,12 @@ class GnuFortranCompiler(FortranCompiler): return ['-Wl,--out-implib=' + implibname] +class ElbrusFortranCompiler(GnuFortranCompiler, ElbrusCompiler): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None, defines=None, **kwargs): + GnuFortranCompiler.__init__(self, exelist, version, gcc_type, is_cross, exe_wrapper, defines, **kwargs) + ElbrusCompiler.__init__(self, gcc_type, defines) + + class G95FortranCompiler(FortranCompiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags): super().__init__(exelist, version, is_cross, exe_wrapper=None, **kwags) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index b3b4a55..67a0fe0 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -49,6 +49,9 @@ from .compilers import ( GnuFortranCompiler, GnuObjCCompiler, GnuObjCPPCompiler, + ElbrusCCompiler, + ElbrusCPPCompiler, + ElbrusFortranCompiler, IntelCCompiler, IntelCPPCompiler, IntelFortranCompiler, @@ -498,15 +501,26 @@ class Environment: continue version = search_version(out) full_version = out.split('\n', 1)[0] - if 'Free Software Foundation' in out or ('e2k' in out and 'lcc' in out): + + guess_gcc_or_lcc = False + if 'Free Software Foundation' in out: + guess_gcc_or_lcc = 'gcc' + if 'e2k' in out and 'lcc' in out: + guess_gcc_or_lcc = 'lcc' + + if guess_gcc_or_lcc: defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler + if guess_gcc_or_lcc == 'lcc': + cls = ElbrusCCompiler if lang == 'c' else ElbrusCPPCompiler + else: + cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) + if 'clang' in out: if 'Apple' in out or mesonlib.for_darwin(want_cross, self): cltype = CLANG_OSX @@ -559,14 +573,24 @@ class Environment: version = search_version(out) full_version = out.split('\n', 1)[0] + guess_gcc_or_lcc = False if 'GNU Fortran' in out: + guess_gcc_or_lcc = 'gcc' + if 'e2k' in out and 'lcc' in out: + guess_gcc_or_lcc = 'lcc' + + if guess_gcc_or_lcc: defines = self.get_gnu_compiler_defines(compiler) if not defines: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue gtype = self.get_gnu_compiler_type(defines) version = self.get_gnu_version_from_defines(defines) - return GnuFortranCompiler(compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) + if guess_gcc_or_lcc == 'lcc': + cls = ElbrusFortranCompiler + else: + cls = GnuFortranCompiler + return cls(compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) if 'G95' in out: return G95FortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version) diff --git a/mesonbuild/modules/rpm.py b/mesonbuild/modules/rpm.py index dbb01f7..5c9ed14 100644 --- a/mesonbuild/modules/rpm.py +++ b/mesonbuild/modules/rpm.py @@ -32,10 +32,17 @@ class RPMModule(ExtensionModule): def generate_spec_template(self, state, args, kwargs): compiler_deps = set() for compiler in state.compilers.values(): + # Elbrus has one 'lcc' package for every compiler if isinstance(compiler, compilers.GnuCCompiler): compiler_deps.add('gcc') elif isinstance(compiler, compilers.GnuCPPCompiler): compiler_deps.add('gcc-c++') + elif isinstance(compiler, compilers.ElbrusCCompiler): + compiler_deps.add('lcc') + elif isinstance(compiler, compilers.ElbrusCPPCompiler): + compiler_deps.add('lcc') + elif isinstance(compiler, compilers.ElbrusFortranCompiler): + compiler_deps.add('lcc') elif isinstance(compiler, compilers.ValaCompiler): compiler_deps.add('vala') elif isinstance(compiler, compilers.GnuFortranCompiler): -- cgit v1.1 From 6230c2a2f61f29cdf92017d7b5a06420f0730114 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Mon, 19 Mar 2018 23:39:06 +0300 Subject: Fixed indentation and space issues found by SideCI --- mesonbuild/compilers/compilers.py | 2 +- mesonbuild/compilers/cpp.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 0ab9b49..2e64131 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1084,7 +1084,7 @@ class ElbrusCompiler(GnuCompiler): self.id = 'lcc' self.base_options = ['b_pgo', 'b_coverage', 'b_ndebug', 'b_staticpic', - 'b_lundef', 'b_asneeded' ] + 'b_lundef', 'b_asneeded'] class ClangCompiler: diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index fd09e46..394c961 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -145,7 +145,7 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler): opts['cpp_std'] = coredata.UserComboOption('cpp_std', 'C++ language standard to use', ['none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y', 'gnu++98', 'gnu++03', 'gnu++0x', 'gnu++11', 'gnu++14', 'gnu++1y'], - 'none') + 'none') return opts -- cgit v1.1 From 08bd07f860081b9545ca4ef4eb7f9684e298f5a6 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Tue, 20 Mar 2018 16:25:08 +0300 Subject: Added specific get_library_dirs function for lcc --- mesonbuild/compilers/compilers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 2e64131..2e6ed7e 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1086,6 +1086,18 @@ class ElbrusCompiler(GnuCompiler): 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded'] + def get_library_dirs(self): + env = os.environ.copy() + env['LC_ALL'] = 'C' + stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=env)[1] + for line in stdo.split('\n'): + if line.startswith('libraries:'): + # lcc does not include '=' in --print-search-dirs output. + libstr = line.split(' ', 1)[1] + return libstr.split(':') + return [] + + class ClangCompiler: def __init__(self, clang_type): -- cgit v1.1 From 3b254c6e49a406235a2c82efa3698bacb0995a35 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Tue, 20 Mar 2018 17:03:32 +0300 Subject: Fixed failure if compiler messages is not in UTF-8 For example, Elbrus lcc does output in KOI8-R, if LC_ALL=C, and there is no English counterpart for original Russian message. --- mesonbuild/compilers/compilers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 2e6ed7e..c072bb6 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -971,7 +971,7 @@ def gnulike_default_include_dirs(compiler, lang): stdout=subprocess.PIPE, env=env ) - stderr = p.stderr.read().decode('utf-8') + stderr = p.stderr.read().decode('utf-8', errors='replace') parse_state = 0 paths = [] for line in stderr.split('\n'): -- cgit v1.1 From 942e34241f9b7430c56b9936c1309665662816bb Mon Sep 17 00:00:00 2001 From: makise-homura Date: Tue, 20 Mar 2018 17:26:04 +0300 Subject: Fixed compatibility issue regarding Python 3.5 In Python 3.5 os.path.join accepts str or bytes, not path-like objects as in Python 3.6. --- mesonbuild/backend/ninjabackend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index b9f614e..a52d1f7 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1166,7 +1166,7 @@ int dummy; abs_vala_file = os.path.join(self.environment.get_build_dir(), vala_file) if PurePath(os.path.commonpath((abs_srcbasedir, abs_vala_file))) == PurePath(abs_srcbasedir): vala_c_subdir = PurePath(abs_vala_file).parent.relative_to(abs_srcbasedir) - vala_c_file = os.path.join(vala_c_subdir, vala_c_file) + vala_c_file = os.path.join(str(vala_c_subdir), vala_c_file) else: path_to_target = os.path.join(self.build_to_src, target.get_subdir()) if vala_file.startswith(path_to_target): -- cgit v1.1 From 546f81e0f943022e27b4aeaea3edd7bc8549093d Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Mar 2018 16:42:15 +0300 Subject: Fixed lchmod detection for lcc C/C++ compilers --- mesonbuild/compilers/c.py | 8 ++++++++ mesonbuild/compilers/cpp.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index be8bb52..47acdd9 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -903,6 +903,14 @@ class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler): 'none')} return opts + # Elbrus C compiler does not have lchmod, but there is only linker warning, not compiler error. + # So we should explicitly fail at this case. + def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None): + if funcname == 'lchmod': + return False + else: + return super().has_function(funcname, prefix, env, extra_args, dependencies) + class IntelCCompiler(IntelCompiler, CCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None, **kwargs): diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 394c961..d2d2585 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -148,6 +148,14 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler): 'none') return opts + # Elbrus C++ compiler does not have lchmod, but there is only linker warning, not compiler error. + # So we should explicitly fail at this case. + def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None): + if funcname == 'lchmod': + return False + else: + return super().has_function(funcname, prefix, env, extra_args, dependencies) + class IntelCPPCompiler(IntelCompiler, CPPCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrap, **kwargs): -- cgit v1.1 From 43be74cf81b2dcb51c46d1ef44d649286d1d703e Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Mar 2018 16:43:04 +0300 Subject: Skipping PCH unit test for lcc compiler --- test cases/common/13 pch/meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test cases/common/13 pch/meson.build b/test cases/common/13 pch/meson.build index 9ed6512..e144aa5 100644 --- a/test cases/common/13 pch/meson.build +++ b/test cases/common/13 pch/meson.build @@ -1,4 +1,10 @@ project('pch test', 'c') +cc = meson.get_compiler('c') +cc_id = cc.get_id() +if cc_id == 'lcc' + error('MESON_SKIP_TEST: Elbrus compiler does not support PCH.') +endif + exe = executable('prog', 'prog.c', c_pch : ['pch/prog_pch.c', 'pch/prog.h']) -- cgit v1.1 From 86fa9b133d94d6d714c7d2e2c81651f9ff9bc87f Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Mar 2018 16:45:22 +0300 Subject: test_reconfigure switched to b_coverage from b_lto This is due to some compilers (e.g. lcc) don't support LTO, and therefore no b_lto meson option is available. --- run_unittests.py | 2 +- test cases/unit/13 reconfigure/meson.build | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/run_unittests.py b/run_unittests.py index fd424be..b42937b 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2543,7 +2543,7 @@ endian = 'little' def test_reconfigure(self): testdir = os.path.join(self.unit_test_dir, '13 reconfigure') - self.init(testdir, ['-Db_lto=true'], default_args=False) + self.init(testdir, ['-Db_coverage=true'], default_args=False) self.build('reconfigure') def test_cross_file_system_paths(self): diff --git a/test cases/unit/13 reconfigure/meson.build b/test cases/unit/13 reconfigure/meson.build index 102180e..453644a 100644 --- a/test cases/unit/13 reconfigure/meson.build +++ b/test cases/unit/13 reconfigure/meson.build @@ -1,5 +1,5 @@ project('reconfigure test', ['c']) -if get_option('b_lto') != true - error('b_lto not set') +if get_option('b_coverage') != true + error('b_coverage not set') endif -- cgit v1.1 From e8dff792d60f7261ad59a9fa5b840e47ff5e3474 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 21 Mar 2018 19:16:02 +0300 Subject: Removed some confusing chars from 'spaces and fun' For example, lcc does not understand !, ^, *, and <. --- run_unittests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run_unittests.py b/run_unittests.py index b42937b..c59c7bf 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1264,7 +1264,8 @@ class AllPlatformTests(BasePlatformTests): # \n is never substituted by the GNU pre-processor via a -D define # ' and " confuse shlex.split() even when they are escaped # % and # confuse the MSVC preprocessor - value = 'spaces and fun!@$^&*()-=_+{}[]:;<>?,./~`' + # !, ^, *, and < confuse lcc preprocessor + value = 'spaces and fun@$&()-=_+{}[]:;>?,./~`' os.environ['CPPFLAGS'] = '-D{}="{}"'.format(define, value) os.environ['CFLAGS'] = '-DMESON_FAIL_VALUE=cflags-read'.format(define) self.init(testdir, ['-D{}={}'.format(define, value)]) -- cgit v1.1 From 72f477748fbbfa4e3e423eea8576059d1b1a218d Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 28 Mar 2018 20:55:11 +0300 Subject: [skip ci] Added lcc and e2k CPU to reference tables --- docs/markdown/Reference-tables.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md index 5ee0db1..55e1cd0 100644 --- a/docs/markdown/Reference-tables.md +++ b/docs/markdown/Reference-tables.md @@ -21,6 +21,7 @@ These are return values of the `get_id` method in a compiler object. | g95 | The G95 Fortran compiler | | open64 | The Open64 Fortran Compiler | | nagfor | The NAG Fortran compiler | +| lcc | Elbrus C/C++/Fortran Compiler | ## Script environment variables @@ -42,6 +43,7 @@ set in the cross file. | x86 | 32 bit x86 processor | | x86_64 | 64 bit x86 processor | | arm | 32 bit ARM processor | +| e2k | MCST Elbrus processor | Any cpu family not listed in the above list is not guaranteed to remain stable in future releases. -- cgit v1.1 From 67f067d5b2161bb21a3d3858c295932004ffa90c Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 28 Mar 2018 21:35:45 +0300 Subject: Added version detection for lcc compiler --- mesonbuild/environment.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 67a0fe0..25be7cb 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -409,6 +409,15 @@ class Environment: return dot.join((major, minor, patch)) @staticmethod + def get_lcc_version_from_defines(defines): + dot = '.' + generation_and_major = defines.get('__LCC__', '100') + generation = generation_and_major[:1] + major = generation_and_major[1:] + minor = defines.get('__LCC_MINOR__', '0') + return dot.join((generation, major, minor)) + + @staticmethod def get_gnu_compiler_type(defines): # Detect GCC type (Apple, MinGW, Cygwin, Unix) if '__APPLE__' in defines: @@ -514,10 +523,11 @@ class Environment: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue gtype = self.get_gnu_compiler_type(defines) - version = self.get_gnu_version_from_defines(defines) if guess_gcc_or_lcc == 'lcc': + version = self.get_lcc_version_from_defines(defines) cls = ElbrusCCompiler if lang == 'c' else ElbrusCPPCompiler else: + version = self.get_gnu_version_from_defines(defines) cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler return cls(ccache + compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) @@ -585,10 +595,11 @@ class Environment: popen_exceptions[' '.join(compiler)] = 'no pre-processor defines' continue gtype = self.get_gnu_compiler_type(defines) - version = self.get_gnu_version_from_defines(defines) if guess_gcc_or_lcc == 'lcc': + version = self.get_lcc_version_from_defines(defines) cls = ElbrusFortranCompiler else: + version = self.get_gnu_version_from_defines(defines) cls = GnuFortranCompiler return cls(compiler, version, gtype, is_cross, exe_wrap, defines, full_version=full_version) -- cgit v1.1 From c8ee45cf15f1a3daefbff519fcb5cc9caa558379 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 28 Mar 2018 21:36:10 +0300 Subject: Skipping tests 22, 64, and 132 for old lcc and icc. This is due to incorrect creation of dependency files: both compilers do not escape spaces in paths. As of version 1.21.22 of lcc, it is announced that this bug will be corrected in future versions. Test 132 was a template for such idea; it has been also extended to react not only to icc, but to lcc too. Further info (if I'm correct): https://software.intel.com/en-us/forums/intel-c-compiler/topic/283156 --- test cases/common/132 dependency file generation/meson.build | 10 ++++++---- test cases/common/22 header in file list/meson.build | 10 ++++++++++ test cases/common/64 custom header generator/meson.build | 10 ++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/test cases/common/132 dependency file generation/meson.build b/test cases/common/132 dependency file generation/meson.build index dcfdcd9..d5e1c07 100644 --- a/test cases/common/132 dependency file generation/meson.build +++ b/test cases/common/132 dependency file generation/meson.build @@ -1,11 +1,13 @@ project('dep file gen', 'c') -cc_id = meson.get_compiler('c').get_id() -if cc_id == 'intel' - # ICC does not escape spaces in paths in the dependency file, so Ninja +cc_id = meson.get_compiler('c').get_id() +cc_ver = meson.get_compiler('c').version() + +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') + # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja # (correctly) thinks that the rule has multiple outputs and errors out: # 'depfile has multiple output paths' - error('MESON_SKIP_TEST: Skipping test with Intel compiler because it generates broken dependency files') + error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') endif e = executable('main file', 'main .c') diff --git a/test cases/common/22 header in file list/meson.build b/test cases/common/22 header in file list/meson.build index cc30c71..5e478cf 100644 --- a/test cases/common/22 header in file list/meson.build +++ b/test cases/common/22 header in file list/meson.build @@ -1,4 +1,14 @@ project('header in file list', 'c') +cc_id = meson.get_compiler('c').get_id() +cc_ver = meson.get_compiler('c').version() + +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') + # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja + # (correctly) thinks that the rule has multiple outputs and errors out: + # 'depfile has multiple output paths' + error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') +endif + exe = executable('prog', 'prog.c', 'header.h') test('basic', exe) diff --git a/test cases/common/64 custom header generator/meson.build b/test cases/common/64 custom header generator/meson.build index bcc9a53..a691dbb 100644 --- a/test cases/common/64 custom header generator/meson.build +++ b/test cases/common/64 custom header generator/meson.build @@ -1,5 +1,15 @@ project('custom header generator', 'c') +cc_id = meson.get_compiler('c').get_id() +cc_ver = meson.get_compiler('c').version() + +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') + # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja + # (correctly) thinks that the rule has multiple outputs and errors out: + # 'depfile has multiple output paths' + error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') +endif + gen = find_program('makeheader.py') generated_h = custom_target('makeheader.py', -- cgit v1.1 From 7c1132b681f7b006a1f9e6dd25ec9008141c7cef Mon Sep 17 00:00:00 2001 From: makise-homura Date: Wed, 28 Mar 2018 21:58:06 +0300 Subject: Added lcc support release snippet --- docs/markdown/snippets/lcc.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/markdown/snippets/lcc.md diff --git a/docs/markdown/snippets/lcc.md b/docs/markdown/snippets/lcc.md new file mode 100644 index 0000000..fb45c5e --- /dev/null +++ b/docs/markdown/snippets/lcc.md @@ -0,0 +1,23 @@ +## Support for lcc compiler for e2k (Elbrus) architecture + +In this version, a support for lcc compiler for Elbrus processors +based on [e2k microarchitecture](https://en.wikipedia.org/wiki/Elbrus_2000) +has been added. + +Examples of such CPUs: +* [Elbrus-8S (Эльбрус-8С)](https://en.wikipedia.org/wiki/Elbrus-8S); +* Elbrus-4S (Эльбрус-4С); +* [Elbrus-2S+ (Эльбрус-2С+)](https://en.wikipedia.org/wiki/Elbrus-2S%2B). + +Such compiler have a similar behavior as gcc (basic option compatibility), +but, in is not strictly compatible with gcc as of current version. + +Major differences as of version 1.21.22: +* it does not support LTO and PCH; +* it suffers from the same dependency file creation error as icc; +* it has minor differences in output, especially version output; +* it differently reacts to lchmod() detection; +* some backend messages are produced in ru_RU.KOI8-R even if LANG=C; +* its preprocessor treats some characters differently. + +So every noted difference is properly handled now in meson. \ No newline at end of file -- cgit v1.1 From 0bea50816b6ffc0f35a15bdbac3cfd00bc13e8e0 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Thu, 29 Mar 2018 21:55:48 +0300 Subject: Removed non-latin characters from lcc snippet It is supposed that it may become source of failures while passing AppVeyor tests. --- docs/markdown/snippets/lcc.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/markdown/snippets/lcc.md b/docs/markdown/snippets/lcc.md index fb45c5e..2ce300d 100644 --- a/docs/markdown/snippets/lcc.md +++ b/docs/markdown/snippets/lcc.md @@ -5,9 +5,9 @@ based on [e2k microarchitecture](https://en.wikipedia.org/wiki/Elbrus_2000) has been added. Examples of such CPUs: -* [Elbrus-8S (Эльбрус-8С)](https://en.wikipedia.org/wiki/Elbrus-8S); -* Elbrus-4S (Эльбрус-4С); -* [Elbrus-2S+ (Эльбрус-2С+)](https://en.wikipedia.org/wiki/Elbrus-2S%2B). +* [Elbrus-8S](https://en.wikipedia.org/wiki/Elbrus-8S); +* Elbrus-4S; +* [Elbrus-2S+](https://en.wikipedia.org/wiki/Elbrus-2S%2B). Such compiler have a similar behavior as gcc (basic option compatibility), but, in is not strictly compatible with gcc as of current version. -- cgit v1.1 From 495f47b12ba0f6463c999a1ec988146fd0b578b8 Mon Sep 17 00:00:00 2001 From: makise-homura Date: Thu, 12 Apr 2018 22:40:53 +0300 Subject: Make more precise CPU detection for Elbrus platform --- mesonbuild/environment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 25be7cb..cb23a5b 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -213,6 +213,9 @@ def detect_cpu(compilers): except mesonlib.MesonException: pass return 'x86_64' + if trial == 'e2k': + # Make more precise CPU detection for Elbrus platform. + trial = platform.processor().lower() # Add fixes here as bugs are reported. return trial -- cgit v1.1 From dfac0ce8d7db2d445fab71410c37a4c3285ec45a Mon Sep 17 00:00:00 2001 From: makise-homura Date: Thu, 12 Apr 2018 22:48:04 +0300 Subject: Clarified version of lcc which will not suffer from depfiles problem --- test cases/common/132 dependency file generation/meson.build | 4 ++-- test cases/common/22 header in file list/meson.build | 4 ++-- test cases/common/64 custom header generator/meson.build | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test cases/common/132 dependency file generation/meson.build b/test cases/common/132 dependency file generation/meson.build index d5e1c07..cd66cb7 100644 --- a/test cases/common/132 dependency file generation/meson.build +++ b/test cases/common/132 dependency file generation/meson.build @@ -3,8 +3,8 @@ project('dep file gen', 'c') cc_id = meson.get_compiler('c').get_id() cc_ver = meson.get_compiler('c').version() -if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') - # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08') + # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja # (correctly) thinks that the rule has multiple outputs and errors out: # 'depfile has multiple output paths' error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') diff --git a/test cases/common/22 header in file list/meson.build b/test cases/common/22 header in file list/meson.build index 5e478cf..ff42cc4 100644 --- a/test cases/common/22 header in file list/meson.build +++ b/test cases/common/22 header in file list/meson.build @@ -3,8 +3,8 @@ project('header in file list', 'c') cc_id = meson.get_compiler('c').get_id() cc_ver = meson.get_compiler('c').version() -if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') - # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08') + # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja # (correctly) thinks that the rule has multiple outputs and errors out: # 'depfile has multiple output paths' error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') diff --git a/test cases/common/64 custom header generator/meson.build b/test cases/common/64 custom header generator/meson.build index a691dbb..1222525 100644 --- a/test cases/common/64 custom header generator/meson.build +++ b/test cases/common/64 custom header generator/meson.build @@ -3,8 +3,8 @@ project('custom header generator', 'c') cc_id = meson.get_compiler('c').get_id() cc_ver = meson.get_compiler('c').version() -if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.21.22') - # ICC and LCC <= 1.21.22 do not escape spaces in paths in the dependency file, so Ninja +if cc_id == 'intel' or (cc_id == 'lcc' and cc_ver.version_compare('<=1.23.08') + # ICC and LCC <= 1.23.08 do not escape spaces in paths in the dependency file, so Ninja # (correctly) thinks that the rule has multiple outputs and errors out: # 'depfile has multiple output paths' error('MESON_SKIP_TEST: Skipping test because your compiler is known to generate broken dependency files') -- cgit v1.1