diff options
author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2019-01-05 00:00:00 +0000 |
---|---|---|
committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2019-01-05 17:22:30 +0100 |
commit | aec1c5a3c1206c26c4d0e553558f40ac8a81b68c (patch) | |
tree | 4b064fc5dc7a44110d2f577b0eb7de1f6cf07ec1 /giscanner/scannerparser.y | |
parent | ca4f195684a65f09b2367029f66fa7694e515708 (diff) | |
download | gobject-introspection-aec1c5a3c1206c26c4d0e553558f40ac8a81b68c.tar.gz |
scanner: Merge basic types in `specifier_qualifier_list` production.
This is necessary to parse types like `unsigned char` or `long double`,
and is already done when parsing `declarations_specifiers`. Examples
that are fixed by this change include:
* `GLib.TestLogMsg.nums` previously parsed as `long` but should be `long
double`.
* `GMime.Encoding.uubuf` previously parsed as `unsigned` but should be
`unsigned char`.
Diffstat (limited to 'giscanner/scannerparser.y')
-rw-r--r-- | giscanner/scannerparser.y | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/giscanner/scannerparser.y b/giscanner/scannerparser.y index 7ce02365..ed4f24fd 100644 --- a/giscanner/scannerparser.y +++ b/giscanner/scannerparser.y @@ -211,7 +211,16 @@ static void set_or_merge_base_type (GISourceType *type, GISourceType *base) { - if (base->type == CTYPE_INVALID) + /* combine basic types like unsigned int and long long */ + if (base->type == CTYPE_BASIC_TYPE && type->type == CTYPE_BASIC_TYPE) + { + char *name = g_strdup_printf ("%s %s", type->name, base->name); + g_free (type->name); + type->name = name; + + ctype_free (base); + } + else if (base->type == CTYPE_INVALID) { g_assert (base->base_type == NULL); @@ -808,15 +817,7 @@ declaration_specifiers | type_specifier declaration_specifiers { $$ = $1; - /* 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 { - set_or_merge_base_type ($1, $2); - } + set_or_merge_base_type ($1, $2); } | type_specifier | type_qualifier declaration_specifiers |