cheat and evade the detection of "open()" in custom_lint

It's a dumb check which doesn't know the difference between python
functions and string data. Work around this by changing the message
output to not include an opening parenthesis, and changing other similar
strings the same way for consistency.
pull/10044/head
Eli Schwartz 3 years ago committed by Dylan Baker
parent 140d6aef04
commit b7dec69b98
  1. 12
      mesonbuild/dependencies/misc.py

@ -63,7 +63,7 @@ def netcdf_factory(env: 'Environment',
class DlBuiltinDependency(BuiltinDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.62.0', "consider checking for dlopen() with and without find_library('dl')")
self.feature_since = ('0.62.0', "consider checking for `dlopen` with and without `find_library('dl')`")
if self.clib_compiler.has_function('dlopen', '#include <dlfcn.h>', env)[0]:
self.is_found = True
@ -72,7 +72,7 @@ class DlBuiltinDependency(BuiltinDependency):
class DlSystemDependency(SystemDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.62.0', "consider checking for dlopen() with and without find_library('dl')")
self.feature_since = ('0.62.0', "consider checking for `dlopen` with and without `find_library('dl')`")
h = self.clib_compiler.has_header('dlfcn.h', '', env)
self.link_args = self.clib_compiler.find_library('dl', env, [], self.libtype)
@ -472,7 +472,7 @@ class CursesSystemDependency(SystemDependency):
class IconvBuiltinDependency(BuiltinDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.60.0', "consider checking for iconv_open() with and without find_library('iconv')")
self.feature_since = ('0.60.0', "consider checking for `iconv_open` with and without `find_library('iconv')`")
code = '''#include <iconv.h>\n\nint main() {\n iconv_open("","");\n}''' # [ignore encoding] this is C, not python, Mr. Lint
if self.clib_compiler.links(code, env)[0]:
@ -482,7 +482,7 @@ class IconvBuiltinDependency(BuiltinDependency):
class IconvSystemDependency(SystemDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.60.0', "consider checking for iconv_open() with and without find_library('iconv')")
self.feature_since = ('0.60.0', "consider checking for `iconv_open` with and without find_library('iconv')")
h = self.clib_compiler.has_header('iconv.h', '', env)
self.link_args = self.clib_compiler.find_library('iconv', env, [], self.libtype)
@ -494,7 +494,7 @@ class IconvSystemDependency(SystemDependency):
class IntlBuiltinDependency(BuiltinDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.59.0', "consider checking for ngettext() with and without find_library('intl')")
self.feature_since = ('0.59.0', "consider checking for `ngettext` with and without `find_library('intl')`")
code = '''#include <libintl.h>\n\nint main() {\n gettext("Hello world");\n}'''
if self.clib_compiler.links(code, env)[0]:
@ -504,7 +504,7 @@ class IntlBuiltinDependency(BuiltinDependency):
class IntlSystemDependency(SystemDependency):
def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__(name, env, kwargs)
self.feature_since = ('0.59.0', "consider checking for ngettext() with and without find_library('intl')")
self.feature_since = ('0.59.0', "consider checking for `ngettext` with and without `find_library('intl')`")
h = self.clib_compiler.has_header('libintl.h', '', env)
self.link_args = self.clib_compiler.find_library('intl', env, [], self.libtype)

Loading…
Cancel
Save