Compare commits

...

4 Commits

Author SHA1 Message Date
Daniel Mensinger cacc585b44 ast: fix #5376 5 years ago
nicole mazzuca 40ff089e69 Allow MSVC-style `cpp_eh` for backwards-compatibility purposes 5 years ago
Antoine Jacoutot e2f6f47fa3 unittests: adapt pkg-config test for OpenBSD 5 years ago
Simon Ney 81170a9cbe This is the fork "sneyx1234/meson" of the current git "mesonbuild/meson" head to converge it to the solaris 11.4 platform based on the sparcv9 and i386 processor architecture. 5 years ago
  1. 10
      mesonbuild/ast/interpreter.py
  2. 2
      mesonbuild/ast/introspection.py
  3. 3
      mesonbuild/compilers/compilers.py
  4. 34
      mesonbuild/compilers/cpp.py
  5. 3
      mesonbuild/mconf.py
  6. 3
      mesonbuild/mesonlib.py
  7. 10
      run_unittests.py
  8. 7
      test cases/unit/55 introspection/meson.build

@ -260,6 +260,12 @@ class AstInterpreter(interpreterbase.InterpreterBase):
id_loop_detect = []
flattend_args = []
if isinstance(args, BaseNode):
assert(hasattr(args, 'ast_id'))
if args.ast_id in id_loop_detect:
return [] # Loop detected
id_loop_detect += [args.ast_id]
if isinstance(args, ArrayNode):
args = [x for x in args.args.arguments]
@ -301,8 +307,8 @@ class AstInterpreter(interpreterbase.InterpreterBase):
# Resolve the contents of args
for i in args:
if isinstance(i, IdNode) and i.value not in id_loop_detect:
flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value])
if isinstance(i, IdNode):
flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect)
elif isinstance(i, (ArrayNode, ArgumentNode, ArithmeticNode, MethodNode)):
flattend_args += self.flatten_args(i, include_unknown_args, id_loop_detect)
elif isinstance(i, mparser.ElementaryNode):

@ -118,7 +118,7 @@ class IntrospectionInterpreter(AstInterpreter):
subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir)
subpr = os.path.join(subproject_dir_abs, dirname)
try:
subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment)
subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment, visitors=self.visitors)
subi.analyze()
subi.project_data['name'] = dirname
self.project_data['subprojects'] += [subi.project_data]

@ -1307,6 +1307,9 @@ class Compiler:
paths = paths + ':' + padding
args.append('-Wl,-rpath,' + paths)
if mesonlib.is_sunos():
return args
if get_compiler_is_linuxlike(self):
# Rpaths to use while linking must be absolute. These are not
# written to the binary. Needed only with GNU ld:

@ -37,6 +37,13 @@ from .compilers import (
from .c_function_attributes import CXX_FUNC_ATTRIBUTES, C_FUNC_ATTRIBUTES
from .clike import CLikeCompiler
def non_msvc_eh_options(eh, args):
if eh == 'none':
args.append('-fno-exceptions')
elif eh == 's' or eh == 'c':
mlog.warning('non-MSVC compilers do not support ' + eh + ' exception handling.' +
'You may want to set eh to \'default\'.')
class CPPCompiler(CLikeCompiler, Compiler):
@classmethod
@ -151,7 +158,7 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler):
opts = CPPCompiler.get_options(self)
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
@ -164,8 +171,9 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler):
std = options['cpp_std']
if std.value != 'none':
args.append(self._find_best_cpp_std(std.value))
if options['cpp_eh'].value == 'none':
args.append('-fno-exceptions')
non_msvc_eh_options(options['cpp_eh'].value, args)
return args
def get_option_link_args(self, options):
@ -189,7 +197,7 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
opts = CPPCompiler.get_options(self)
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17',
@ -202,8 +210,9 @@ class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
std = options['cpp_std']
if std.value != 'none':
args.append('-std=' + std.value)
if options['cpp_eh'].value == 'none':
args.append('-fno-exceptions')
non_msvc_eh_options(options['cpp_eh'].value, args)
return args
def get_option_link_args(self, options):
@ -224,7 +233,7 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
opts = CPPCompiler.get_options(self)
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
@ -244,8 +253,9 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler):
std = options['cpp_std']
if std.value != 'none':
args.append(self._find_best_cpp_std(std.value))
if options['cpp_eh'].value == 'none':
args.append('-fno-exceptions')
non_msvc_eh_options(options['cpp_eh'].value, args)
if options['cpp_debugstl'].value:
args.append('-D_GLIBCXX_DEBUG=1')
return args
@ -278,7 +288,7 @@ class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
opts = CPPCompiler.get_options(self)
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y',
@ -328,7 +338,7 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler):
g_stds += ['gnu++14']
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
['none'] + c_stds + g_stds,
@ -367,7 +377,7 @@ class VisualStudioLikeCPPCompilerMixin:
def _get_options_impl(self, opts, cpp_stds: typing.List[str]):
opts.update({'cpp_eh': coredata.UserComboOption('cpp_eh',
'C++ exception handling type.',
['none', 'a', 's', 'sc', 'default'],
['none', 'default', 'a', 's', 'sc'],
'default'),
'cpp_std': coredata.UserComboOption('cpp_std',
'C++ language standard to use',

@ -14,6 +14,7 @@
import os
from . import coredata, environment, mesonlib, build, mintro, mlog
from .ast import AstIDGenerator
def add_arguments(parser):
coredata.register_builtin_arguments(parser)
@ -52,7 +53,7 @@ class Conf:
# Make sure that log entries in other parts of meson don't interfere with the JSON output
mlog.disable()
self.source_dir = os.path.abspath(os.path.realpath(self.build_dir))
intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja')
intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja', visitors = [AstIDGenerator()])
intr.analyze()
# Reenable logging just in case
mlog.enable()

@ -344,6 +344,9 @@ class PerMachine(typing.Generic[_T]):
}[machine]
setattr(self, key, val)
def is_sunos() -> bool:
return platform.system().lower() == 'sunos'
def is_osx() -> bool:
return platform.system().lower() == 'darwin'

@ -4249,11 +4249,17 @@ class LinuxlikeTests(BasePlatformTests):
cmd = ['pkg-config', 'requires-test']
out = self._run(cmd + ['--print-requires']).strip().split('\n')
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
if not is_openbsd():
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
else:
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
cmd = ['pkg-config', 'requires-private-test']
out = self._run(cmd + ['--print-requires-private']).strip().split('\n')
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
if not is_openbsd():
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
else:
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
def test_pkg_unfound(self):
testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig')

@ -34,6 +34,13 @@ systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machin
message(systype)
### END: Test inspired by taisei
# Minimal code version to produce bug #5376
# Code inspired by https://github.com/mesa3d/mesa/blob/974c4d679c23373dbed386c696e3e3bc1bfa23ae/meson.build#L1341-L1347
osmesa_lib_name = 'OSMesa'
osmesa_bits = '8'
osmesa_lib_name = osmesa_lib_name + osmesa_bits
message(osmesa_lib_name) # Infinite recursion gets triggered here when the parameter osmesa_lib_name is resolved
test('test case 1', t1)
test('test case 2', t2)
benchmark('benchmark 1', t3)

Loading…
Cancel
Save