Bug 552370: unsigned not scanned properly
authorJürg Billeter <j@bitron.ch>
Sat, 11 Oct 2008 20:43:21 +0000 (20:43 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Sat, 11 Oct 2008 20:43:21 +0000 (20:43 +0000)
2008-10-11  Jürg Billeter  <j@bitron.ch>

Bug 552370: unsigned not scanned properly

* giscanner/scannerparser.y: combine basic types such as unsigned
int and long long when scanning
* tests/scanner/foo-expected.gir:
* tests/scanner/foo.c: (foo_test_unsigned):
* tests/scanner/foo.h: test that

svn path=/trunk/; revision=666

ChangeLog
giscanner/scannerparser.y
tests/scanner/foo-expected.gir
tests/scanner/foo.c
tests/scanner/foo.h

index d180458..c4de377 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-10-11  Jürg Billeter  <j@bitron.ch>
+
+       Bug 552370: unsigned not scanned properly
+
+       * giscanner/scannerparser.y: combine basic types such as unsigned
+       int and long long when scanning
+       * tests/scanner/foo-expected.gir:
+       * tests/scanner/foo.c: (foo_test_unsigned):
+       * tests/scanner/foo.h: test that
+
 2008-10-11  Lucas Rocha  <lucasr@gnome.org>
 
        Bug 554854: The --typelib-xml and --inject options should reuse
index 53a30a3..43a5ae0 100644 (file)
@@ -559,7 +559,15 @@ declaration_specifiers
        | type_specifier declaration_specifiers
          {
                $$ = $1;
-               $$->base_type = $2;
+               /* combine basic types like unsigned int and long long */
+               if ($$->type == CTYPE_BASIC_TYPE && $2->type == CTYPE_BASIC_TYPE) {
+                       char *name = g_strdup_printf ("%s %s", $$->name, $2->name);
+                       g_free ($$->name);
+                       $$->name = name;
+                       ctype_free ($2);
+               } else {
+                       $$->base_type = $2;
+               }
          }
        | type_specifier
        | type_qualifier declaration_specifiers
index 2eec8f6..e498cdf 100644 (file)
       </return-value>
     </function>
     <enumeration name="EnumType"
-                 c:type="FooEnumType"
                  glib:type-name="FooEnumType"
-                 glib:get-type="foo_enum_type_get_type">
+                 glib:get-type="foo_enum_type_get_type"
+                 c:type="FooEnumType">
       <member name="alpha"
               value="0"
               c:identifier="FOO_ENUM_ALPHA"
       </parameters>
     </function>
     <bitfield name="FlagsType"
-              c:type="FooFlagsType"
               glib:type-name="FooFlagsType"
-              glib:get-type="foo_flags_type_get_type">
+              glib:get-type="foo_flags_type_get_type"
+              c:type="FooFlagsType">
       <member name="first"
               value="1"
               c:identifier="FOO_FLAGS_FIRST"
         </return-value>
       </method>
     </union>
+    <function name="test_unsigned" c:identifier="foo_test_unsigned">
+      <return-value>
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="unsigned_param">
+          <type name="uint" c:type="unsigned int"/>
+        </parameter>
+      </parameters>
+    </function>
   </namespace>
 </repository>
index d1a1c67..4c2d3cc 100644 (file)
@@ -318,3 +318,8 @@ foo_bunion_get_type (void)
                                             (GBoxedFreeFunc) g_free);
   return our_type;
 }
+
+void foo_test_unsigned (unsigned int uint)
+{
+}
+
index bcb899d..c046dbc 100644 (file)
@@ -227,4 +227,6 @@ GType foo_bunion_get_type (void);
 
 int foo_bunion_get_contained_type (FooBUnion *bunion);
 
+void foo_test_unsigned (unsigned int unsigned_param);
+
 #endif /* __FOO_OBJECT_H__ */