summaryrefslogtreecommitdiff
path: root/giscanner/transformer.py
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-08-10 15:04:55 +0200
committerColin Walters <walters@verbum.org>2011-08-10 10:43:07 -0400
commitd19fcd098ed69d9216efbf68fc8ae4ba57d09638 (patch)
tree7d9d6ed02f02b454af7a8fc025a3a8adf830d88f /giscanner/transformer.py
parent7f178ddeadd99ee82ec0da6ff963392b44d223c3 (diff)
downloadgobject-introspection-d19fcd098ed69d9216efbf68fc8ae4ba57d09638.tar.gz
Make the Transformer respect 'skip' annotations
* In order to suppress unnecessary warnings on macros which are skipped at later passes of the scanning, we use the annotations to skip AST stuff being created for symbols that are skipped.
Diffstat (limited to 'giscanner/transformer.py')
-rw-r--r--giscanner/transformer.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 7db79828..6689fc73 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -54,6 +54,7 @@ class Transformer(object):
self._include_names = set() # string namespace
self._includepaths = []
self._passthrough_mode = False
+ self._annotations = {}
def get_includes(self):
return self._include_names
@@ -67,6 +68,9 @@ class Transformer(object):
def set_passthrough_mode(self):
self._passthrough_mode = True
+ def set_annotations(self, annotations):
+ self._annotations = annotations
+
def _append_new_node(self, node):
original = self._namespace.get(node.name)
# Special case constants here; we allow duplication to sort-of
@@ -313,7 +317,10 @@ raise ValueError."""
elif stype == CSYMBOL_TYPE_UNION:
return self._create_union(symbol)
elif stype == CSYMBOL_TYPE_CONST:
- return self._create_const(symbol)
+ # Don't parse constants which are marked (skip)
+ docblock = self._annotations.get(symbol.ident)
+ if not docblock or not 'skip' in docblock.options:
+ return self._create_const(symbol)
# Ignore variable declarations in the header
elif stype == CSYMBOL_TYPE_OBJECT:
pass