diff options
author | Krzesimir Nowak <qdlacz@gmail.com> | 2012-07-04 22:52:02 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2012-07-07 17:13:40 -0400 |
commit | 3943988d5addbea4603f9b4ee5103c604d03e8f4 (patch) | |
tree | e5ca09e5c92ad4b1215d8e37ebaa071064cd60e6 /tests | |
parent | 09fe4ca9b3e816f87698761f4b66bc2d0c25e4e0 (diff) | |
download | gobject-introspection-3943988d5addbea4603f9b4ee5103c604d03e8f4.tar.gz |
giscanner: Write detailed information in "type" tag's "c:type" attribute.
That is - write also type qualifiers (const and volatile here). Update
existing tests and add a new struct to regress.h having members with
type qualifiers.
https://bugzilla.gnome.org/show_bug.cgi?id=656445
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scanner/Annotation-1.0-expected.gir | 10 | ||||
-rw-r--r-- | tests/scanner/Foo-1.0-expected.gir | 18 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 90 | ||||
-rw-r--r-- | tests/scanner/Utility-1.0-expected.gir | 6 | ||||
-rw-r--r-- | tests/scanner/regress.h | 14 |
5 files changed, 88 insertions, 50 deletions
diff --git a/tests/scanner/Annotation-1.0-expected.gir b/tests/scanner/Annotation-1.0-expected.gir index ce43b36d..2ea6c544 100644 --- a/tests/scanner/Annotation-1.0-expected.gir +++ b/tests/scanner/Annotation-1.0-expected.gir @@ -39,12 +39,12 @@ and/or use gtk-doc annotations. --> <doc xml:whitespace="preserve">This is a callback.</doc> <return-value transfer-ownership="none"> <doc xml:whitespace="preserve">array of ints</doc> - <type name="gint" c:type="gint*"/> + <type name="gint" c:type="const gint*"/> </return-value> <parameters> <parameter name="in" transfer-ownership="none"> <doc xml:whitespace="preserve">array of ints</doc> - <type name="gint" c:type="gint*"/> + <type name="gint" c:type="const gint*"/> </parameter> </parameters> </callback> @@ -57,7 +57,7 @@ and/or use gtk-doc annotations. --> <type name="Object" c:type="AnnotationObject*"/> </parameter> <parameter name="item" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="user_data" transfer-ownership="none" closure="2"> <type name="gpointer" c:type="gpointer"/> @@ -110,7 +110,7 @@ and/or use gtk-doc annotations. --> </return-value> <parameters> <parameter name="somearg" transfer-ownership="none" allow-none="1"> - <type name="utf8" c:type="gchar*"/> + <type name="utf8" c:type="const gchar*"/> </parameter> </parameters> </method> @@ -659,7 +659,7 @@ it says it's pointer but it's actually a string.</doc> <attribute name="some.annotation" value="value"/> <attribute name="another.annotation" value="blahvalue"/> <doc xml:whitespace="preserve">Some data.</doc> - <type name="utf8" c:type="gchar*"/> + <type name="utf8" c:type="const gchar*"/> </parameter> </parameters> </function> diff --git a/tests/scanner/Foo-1.0-expected.gir b/tests/scanner/Foo-1.0-expected.gir index b18375a1..b0c36340 100644 --- a/tests/scanner/Foo-1.0-expected.gir +++ b/tests/scanner/Foo-1.0-expected.gir @@ -446,7 +446,7 @@ uses a C sugar return type.</doc> </method> <method name="get_name" c:identifier="foo_object_get_name"> <return-value transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </return-value> </method> <method name="handle_glyph" c:identifier="foo_object_handle_glyph"> @@ -478,7 +478,7 @@ uses a C sugar return type.</doc> </return-value> <parameters> <parameter name="target" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </method> @@ -661,7 +661,7 @@ uses a C sugar return type.</doc> <parameters> <parameter name="r2" transfer-ownership="none"> <doc xml:whitespace="preserve">source rectangle</doc> - <type name="Rectangle" c:type="FooRectangle*"/> + <type name="Rectangle" c:type="const FooRectangle*"/> </parameter> </parameters> </method> @@ -910,7 +910,7 @@ exposed to language bindings.</doc> <type name="gint" c:type="int"/> </field> <field name="lines" writable="1"> - <array zero-terminated="0" c:type="gchar" fixed-size="80"> + <array zero-terminated="0" c:type="char" fixed-size="80"> <type name="gchar" c:type="char"/> </array> </field> @@ -936,7 +936,7 @@ exposed to language bindings.</doc> </return-value> <parameters> <parameter name="param" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter transfer-ownership="none"> <varargs> @@ -1143,14 +1143,14 @@ exposed to language bindings.</doc> </return-value> <parameters> <parameter name="param" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </function> <function name="test_const_char_retval" c:identifier="foo_test_const_char_retval"> <return-value transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </return-value> </function> <function name="test_const_struct_param" @@ -1160,14 +1160,14 @@ exposed to language bindings.</doc> </return-value> <parameters> <parameter name="param" transfer-ownership="none"> - <type name="Struct" c:type="FooStruct*"/> + <type name="Struct" c:type="const FooStruct*"/> </parameter> </parameters> </function> <function name="test_const_struct_retval" c:identifier="foo_test_const_struct_retval"> <return-value transfer-ownership="none"> - <type name="Struct" c:type="FooStruct*"/> + <type name="Struct" c:type="const FooStruct*"/> </return-value> </function> <function name="test_string_array" c:identifier="foo_test_string_array"> diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 3f2b6ddf..0b39bff8 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -275,7 +275,7 @@ use it should be.</doc> </return-value> <parameters> <parameter name="error" transfer-ownership="none"> - <type name="GLib.Error" c:type="GError*"/> + <type name="GLib.Error" c:type="const GError*"/> </parameter> </parameters> </callback> @@ -351,7 +351,7 @@ use it should be.</doc> glib:nick="value4"/> <function name="param" c:identifier="regress_test_enum_param"> <return-value transfer-ownership="none"> - <type name="utf8" c:type="gchar*"/> + <type name="utf8" c:type="const gchar*"/> </return-value> <parameters> <parameter name="e" transfer-ownership="none"> @@ -502,7 +502,7 @@ use it should be.</doc> <parameters> <parameter name="obj" transfer-ownership="none"> <type name="TestFundamentalObject" - c:type="RegressTestFundamentalObject*"/> + c:type="const RegressTestFundamentalObject*"/> </parameter> </parameters> </callback> @@ -534,7 +534,7 @@ use it should be.</doc> </return-value> <parameters> <parameter name="data" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </constructor> @@ -621,7 +621,7 @@ use it should be.</doc> </return-value> <parameters> <parameter name="x" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </constructor> @@ -686,7 +686,7 @@ case.</doc> <parameters> <parameter name="somestr" transfer-ownership="none"> <doc xml:whitespace="preserve">Meaningless string</doc> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </virtual-method> @@ -700,7 +700,7 @@ case.</doc> <parameters> <parameter name="somestr" transfer-ownership="none"> <doc xml:whitespace="preserve">Meaningless string</doc> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </method> @@ -983,7 +983,7 @@ raise an error.</doc> <type name="gint" c:type="int*"/> </parameter> <parameter name="foo" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="q" direction="out" @@ -1020,7 +1020,7 @@ raise an error.</doc> <type name="gint" c:type="int*"/> </parameter> <parameter name="foo" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="q" direction="out" @@ -1237,7 +1237,7 @@ Use with regress_test_obj_emit_sig_with_obj</doc> </parameter> <parameter name="somestr" transfer-ownership="none"> <doc xml:whitespace="preserve">Meaningless string</doc> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </callback> @@ -1357,7 +1357,8 @@ Use with regress_test_obj_emit_sig_with_obj</doc> <function name="const_return" c:identifier="regress_test_simple_boxed_a_const_return"> <return-value transfer-ownership="none"> - <type name="TestSimpleBoxedA" c:type="RegressTestSimpleBoxedA*"/> + <type name="TestSimpleBoxedA" + c:type="const RegressTestSimpleBoxedA*"/> </return-value> </function> </record> @@ -1507,6 +1508,29 @@ Use with regress_test_obj_emit_sig_with_obj</doc> <type name="gpointer" c:type="gpointer"/> </field> </union> + <record name="TestStructF" c:type="RegressTestStructF"> + <field name="ref_count" writable="1"> + <type name="gint" c:type="volatile gint"/> + </field> + <field name="data1" writable="1"> + <type name="gint" c:type="const gint*"/> + </field> + <field name="data2" writable="1"> + <type name="gint" c:type="const gint* const"/> + </field> + <field name="data3" writable="1"> + <type name="gint" c:type="const gint* const* const"/> + </field> + <field name="data4" writable="1"> + <type name="gint" c:type="const gint** const*"/> + </field> + <field name="data5" writable="1"> + <type name="gint" c:type="volatile gint* const"/> + </field> + <field name="data6" writable="1"> + <type name="gint" c:type="const gint* volatile"/> + </field> + </record> <record name="TestStructFixedArray" c:type="RegressTestStructFixedArray"> <field name="just_int" writable="1"> <type name="gint" c:type="gint"/> @@ -2298,7 +2322,7 @@ call and can be released on return.</doc> c:identifier="regress_test_enum_param" moved-to="TestEnum.param"> <return-value transfer-ownership="none"> - <type name="utf8" c:type="gchar*"/> + <type name="utf8" c:type="const gchar*"/> </return-value> <parameters> <parameter name="e" transfer-ownership="none"> @@ -2435,7 +2459,7 @@ element-type annotation.</doc> </return-value> <parameters> <parameter name="in" transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> + <type name="GLib.HashTable" c:type="const GHashTable*"> <type name="utf8"/> <type name="utf8"/> </type> @@ -2459,7 +2483,7 @@ element-type annotation.</doc> <function name="test_ghash_nothing_return" c:identifier="regress_test_ghash_nothing_return"> <return-value transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> + <type name="GLib.HashTable" c:type="const GHashTable*"> <type name="utf8"/> <type name="utf8"/> </type> @@ -2481,7 +2505,7 @@ element-type annotation.</doc> </return-value> <parameters> <parameter name="in" transfer-ownership="none" allow-none="1"> - <type name="GLib.HashTable" c:type="GHashTable*"> + <type name="GLib.HashTable" c:type="const GHashTable*"> <type name="utf8"/> <type name="utf8"/> </type> @@ -2499,7 +2523,7 @@ element-type annotation.</doc> caller-allocates="0" transfer-ownership="full" allow-none="1"> - <type name="GLib.HashTable" c:type="GHashTable**"> + <type name="GLib.HashTable" c:type="const GHashTable**"> <type name="utf8"/> <type name="utf8"/> </type> @@ -2509,7 +2533,7 @@ element-type annotation.</doc> <function name="test_ghash_null_return" c:identifier="regress_test_ghash_null_return"> <return-value transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> + <type name="GLib.HashTable" c:type="const GHashTable*"> <type name="utf8"/> <type name="utf8"/> </type> @@ -2538,7 +2562,7 @@ element-type annotation.</doc> </return-value> <parameters> <parameter name="in" transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> + <type name="GLib.List" c:type="const GList*"> <type name="utf8"/> </type> </parameter> @@ -2560,7 +2584,7 @@ element-type annotation.</doc> <function name="test_glist_nothing_return" c:identifier="regress_test_glist_nothing_return"> <return-value transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> + <type name="GLib.List" c:type="const GList*"> <type name="utf8"/> </type> </return-value> @@ -2626,7 +2650,7 @@ element-type annotation.</doc> </return-value> <parameters> <parameter name="in" transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> + <type name="GLib.SList" c:type="const GSList*"> <type name="utf8"/> </type> </parameter> @@ -2648,7 +2672,7 @@ element-type annotation.</doc> <function name="test_gslist_nothing_return" c:identifier="regress_test_gslist_nothing_return"> <return-value transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> + <type name="GLib.SList" c:type="const GSList*"> <type name="utf8"/> </type> </return-value> @@ -2814,7 +2838,7 @@ element-type annotation.</doc> <type name="gint" c:type="int*"/> </parameter> <parameter name="in" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </function> @@ -2825,7 +2849,7 @@ element-type annotation.</doc> </return-value> <parameters> <parameter name="v" transfer-ownership="none"> - <type name="GObject.Value" c:type="GValue*"/> + <type name="GObject.Value" c:type="const GValue*"/> </parameter> </parameters> </function> @@ -2966,7 +2990,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d c:identifier="regress_test_simple_boxed_a_const_return" moved-to="TestSimpleBoxedA.const_return"> <return-value transfer-ownership="none"> - <type name="TestSimpleBoxedA" c:type="RegressTestSimpleBoxedA*"/> + <type name="TestSimpleBoxedA" c:type="const RegressTestSimpleBoxedA*"/> </return-value> </function> <function name="test_simple_callback" @@ -3030,7 +3054,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d </function> <function name="test_strv_out_c" c:identifier="regress_test_strv_out_c"> <return-value transfer-ownership="none"> - <array c:type="char**"> + <array c:type="const char* const*"> <type name="utf8"/> </array> </return-value> @@ -3090,7 +3114,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d <type name="gint" c:type="int*"/> </parameter> <parameter name="foo" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="q" direction="out" @@ -3127,7 +3151,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d <type name="gint" c:type="int*"/> </parameter> <parameter name="foo" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="q" direction="out" @@ -3176,7 +3200,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d <type name="gint" c:type="int*"/> </parameter> <parameter name="foo" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="q" direction="out" @@ -3269,7 +3293,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d <function name="test_unsigned_enum_param" c:identifier="regress_test_unsigned_enum_param"> <return-value transfer-ownership="none"> - <type name="utf8" c:type="gchar*"/> + <type name="utf8" c:type="const gchar*"/> </return-value> <parameters> <parameter name="e" transfer-ownership="none"> @@ -3294,7 +3318,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d </return-value> <parameters> <parameter name="in" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> </parameters> </function> @@ -3302,7 +3326,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d c:identifier="regress_test_utf8_const_return"> <return-value transfer-ownership="none"> <doc xml:whitespace="preserve">UTF-8 string</doc> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </return-value> </function> <function name="test_utf8_inout" c:identifier="regress_test_utf8_inout"> @@ -3411,7 +3435,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d </return-value> <parameters> <parameter name="value" transfer-ownership="none"> - <type name="GObject.Value" c:type="GValue*"/> + <type name="GObject.Value" c:type="const GValue*"/> </parameter> </parameters> </function> @@ -3419,7 +3443,7 @@ What we're testing here is that the scanner ignores the @a nested inside XML.</d c:identifier="regress_test_value_return"> <return-value transfer-ownership="none"> <doc xml:whitespace="preserve">the int wrapped in a GValue.</doc> - <type name="GObject.Value" c:type="GValue*"/> + <type name="GObject.Value" c:type="const GValue*"/> </return-value> <parameters> <parameter name="i" transfer-ownership="none"> diff --git a/tests/scanner/Utility-1.0-expected.gir b/tests/scanner/Utility-1.0-expected.gir index dec79840..747f99c1 100644 --- a/tests/scanner/Utility-1.0-expected.gir +++ b/tests/scanner/Utility-1.0-expected.gir @@ -50,7 +50,7 @@ and/or use gtk-doc annotations. --> </return-value> <parameters> <parameter name="path" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="user_data" transfer-ownership="none" closure="1"> <type name="gpointer" c:type="gpointer"/> @@ -75,7 +75,7 @@ and/or use gtk-doc annotations. --> </return-value> <parameters> <parameter name="path" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="func" transfer-ownership="none" @@ -152,7 +152,7 @@ and/or use gtk-doc annotations. --> </return-value> <parameters> <parameter name="path" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> + <type name="utf8" c:type="const char*"/> </parameter> <parameter name="func" transfer-ownership="none" diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index 13916374..97b9135b 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -262,6 +262,7 @@ typedef struct _RegressTestStructA RegressTestStructA; typedef struct _RegressTestStructB RegressTestStructB; typedef struct _RegressTestStructC RegressTestStructC; typedef struct _RegressTestStructD RegressTestStructD; +typedef struct _RegressTestStructF RegressTestStructF; struct _RegressTestStructA { @@ -298,6 +299,7 @@ struct _RegressTestStructC * @field: (type RegressTestObj): * @list: (element-type RegressTestObj): * @garray: (element-type RegressTestObj): + * @ref_count: */ struct _RegressTestStructD { @@ -325,6 +327,18 @@ struct RegressTestStructE } some_union[2]; }; +/* This one has members with const or volatile modifiers. */ +struct _RegressTestStructF +{ + volatile gint ref_count; + const gint *data1; + const gint *const data2; + const gint *const *const data3; + const gint **const* data4; + volatile gint *const data5; + const gint *volatile data6; +}; + /* plain-old-data boxed types */ typedef struct _RegressTestSimpleBoxedA RegressTestSimpleBoxedA; typedef struct _RegressTestSimpleBoxedB RegressTestSimpleBoxedB; |