aboutsummaryrefslogtreecommitdiff
path: root/find-modules
diff options
context:
space:
mode:
authorShaheed Haque <srhaque@theiet.org>2017-02-04 11:00:16 +0000
committerStephen Kelly <steveire@gmail.com>2017-02-04 11:27:15 +0000
commit050f15ef6a0c44dc6a7abbbe0f1954ea1925f473 (patch)
tree2e28042d4fd929d863a7c1e48d0a32d54ff9eb55 /find-modules
parent4e17330a4520b1994a6488993a2a887f1f051d72 (diff)
downloadextra-cmake-modules-050f15ef6a0c44dc6a7abbbe0f1954ea1925f473.tar.gz
extra-cmake-modules-050f15ef6a0c44dc6a7abbbe0f1954ea1925f473.tar.bz2
Bindings: Take account of visibility attribute on APIs
Don't export API which has visibility "hidden". Visibility attributes on variables are ignored, but call the generic method anyway. Remove checks for macros which obscure the attributes. Processing the attribute directly means that is not needed.
Diffstat (limited to 'find-modules')
-rw-r--r--find-modules/sip_generator.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py
index ca5f550b..5311e8c5 100644
--- a/find-modules/sip_generator.py
+++ b/find-modules/sip_generator.py
@@ -159,11 +159,8 @@ class SipGenerator(object):
return body, self.tu.get_includes
CONTAINER_SKIPPABLE_UNEXPOSED_DECL = re.compile("_DECLARE_PRIVATE|friend|;")
- FN_SKIPPABLE_ATTR = re.compile("_EXPORT|Q_REQUIRED_RESULT|format\(printf")
- VAR_SKIPPABLE_ATTR = re.compile("_EXPORT")
- TYPEDEF_SKIPPABLE_ATTR = re.compile("_EXPORT")
- def skippable_attribute(self, parent, member, text, skippable_re):
+ def skippable_attribute(self, parent, member, text, sip):
"""
We don't seem to have access to the __attribute__(())s, but at least we can look for stuff we care about.
@@ -172,7 +169,10 @@ class SipGenerator(object):
"""
if member.kind != CursorKind.VISIBILITY_ATTR:
return False
- if skippable_re.search(text):
+ if member.spelling == "hidden":
+ if self.dump_privates:
+ logger.debug("Ignoring private {}".format(SipGenerator.describe(parent)))
+ sip["name"] = ""
return True
return False
@@ -488,8 +488,9 @@ class SipGenerator(object):
template_parameters.append(child.type.spelling + " " + child.displayname)
else:
text = self._read_source(child.extent)
- if self.skippable_attribute(function, child, text, SipGenerator.FN_SKIPPABLE_ATTR):
- pass
+ if self.skippable_attribute(function, child, text, sip):
+ if not sip["name"]:
+ return ""
else:
SipGenerator._report_ignoring(function, child)
#
@@ -697,8 +698,9 @@ class SipGenerator(object):
pass
else:
text = self._read_source(child.extent)
- if self.skippable_attribute(variable, child, text, SipGenerator.VAR_SKIPPABLE_ATTR):
- pass
+ if self.skippable_attribute(variable, child, text, sip):
+ if not sip["name"]:
+ return ""
else:
SipGenerator._report_ignoring(variable, child)
#