summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2018-02-09 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2018-02-09 10:00:30 +0100
commit4bfdc83b063bce3821b09e88e5ee3207a10259d2 (patch)
tree1321e2fb20653678c29457517da0aa590a0101f1
parent31ab9496cb882a21a1b64b1ef39f06514073dea5 (diff)
downloadgobject-introspection-4bfdc83b063bce3821b09e88e5ee3207a10259d2.tar.gz
Preserve complete_ctype when using type from annotation.
When replacing type with one from user annotation we already preserve ctype, do the same for complete_ctype to preserve const / volatile qualifiers if any. Fixes issue #190.
-rw-r--r--giscanner/maintransformer.py1
-rw-r--r--tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page4
-rw-r--r--tests/scanner/Regress-1.0-expected.gir2
3 files changed, 4 insertions, 3 deletions
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 23ed4102..275f1c08 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -330,6 +330,7 @@ class MainTransformer(object):
# might lose the ctype from the original node.
if type_node is not None:
result.ctype = type_node.ctype
+ result.complete_ctype = type_node.complete_ctype
return result
def _get_position(self, func, param):
diff --git a/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page b/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
index 2f7fb864..5d8197a2 100644
--- a/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
+++ b/tests/scanner/Regress-1.0-C-expected/Regress.annotation_set_source_file.page
@@ -13,14 +13,14 @@
</api:returns>
<api:name>regress_annotation_set_source_file</api:name>
<api:arg>
- <api:type>char*</api:type>
+ <api:type>const char*</api:type>
<api:name>fname</api:name>
</api:arg>
</api:function>
</info>
<title>regress_annotation_set_source_file</title>
<synopsis><code mime="text/x-csrc">
-void regress_annotation_set_source_file (char* fname);
+void regress_annotation_set_source_file (const char* fname);
</code></synopsis>
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index 2e4830cf..980ad650 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -4502,7 +4502,7 @@ detection, and fixing it via annotations.</doc>
<parameters>
<parameter name="fname" transfer-ownership="none">
<doc xml:space="preserve">Source file</doc>
- <type name="filename" c:type="char*"/>
+ <type name="filename" c:type="const char*"/>
</parameter>
</parameters>
</function>