summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2019-07-22 19:36:00 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2019-07-22 19:44:54 +0200
commitedca61f92810bb0cc0f5aac1ee36dd0d487a917f (patch)
tree6fd1d050aa5d61ba36c6561ffba2f7fc9c75b042 /giscanner
parent0f3efc9058e2f249e84c02840fd96b6a413a9201 (diff)
downloadgobject-introspection-edca61f92810bb0cc0f5aac1ee36dd0d487a917f.tar.gz
transformer: only include function macros from headers. See #159
We already do the same thing for constants (see _create_const()). Otherwise macros in .c files which aren't namespaced will trigger a warning.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/transformer.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index a3cf3126..f63894cb 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -459,6 +459,10 @@ raise ValueError."""
def _create_function_macro(self, symbol):
if symbol.ident.startswith('_'):
return None
+
+ if (symbol.source_filename is None or not symbol.source_filename.endswith('.h')):
+ return None
+
parameters = list(self._create_parameters(symbol, symbol.base_type))
name = self._strip_symbol(symbol)
macro = ast.FunctionMacro(name, parameters, symbol.ident)