projects
/
cparser
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make the input encoding selectable via −finput‐charset=. Currently suported are...
[cparser]
/
type.c
diff --git
a/type.c
b/type.c
index
8ae9e37
..
1ddba55
100644
(file)
--- a/
type.c
+++ b/
type.c
@@
-823,12
+823,7
@@
type_t *get_unqualified_type(type_t *type)
type_t *unqualified_type = duplicate_type(type);
unqualified_type->base.qualifiers = TYPE_QUALIFIER_NONE;
type_t *unqualified_type = duplicate_type(type);
unqualified_type->base.qualifiers = TYPE_QUALIFIER_NONE;
- type_t *result = typehash_insert(unqualified_type);
- if (result != unqualified_type) {
- obstack_free(type_obst, unqualified_type);
- }
-
- return result;
+ return identify_new_type(unqualified_type);
}
type_t *get_qualified_type(type_t *orig_type, type_qualifiers_t const qual)
}
type_t *get_qualified_type(type_t *orig_type, type_qualifiers_t const qual)
@@
-856,11
+851,7
@@
type_t *get_qualified_type(type_t *orig_type, type_qualifiers_t const qual)
return type;
}
return type;
}
- type = typehash_insert(copy);
- if (type != copy)
- obstack_free(type_obst, copy);
-
- return type;
+ return identify_new_type(copy);
}
/**
}
/**
@@
-1220,17
+1211,18
@@
type_t *skip_typeref(type_t *type)
{
type_qualifiers_t qualifiers = TYPE_QUALIFIER_NONE;
type_modifiers_t modifiers = TYPE_MODIFIER_NONE;
{
type_qualifiers_t qualifiers = TYPE_QUALIFIER_NONE;
type_modifiers_t modifiers = TYPE_MODIFIER_NONE;
-
unsigned char
alignment = 0;
+
il_alignment_t
alignment = 0;
while (true) {
while (true) {
+ if (alignment < type->base.alignment)
+ alignment = type->base.alignment;
+
switch (type->kind) {
case TYPE_ERROR:
return type;
case TYPE_TYPEDEF: {
qualifiers |= type->base.qualifiers;
modifiers |= type->base.modifiers;
switch (type->kind) {
case TYPE_ERROR:
return type;
case TYPE_TYPEDEF: {
qualifiers |= type->base.qualifiers;
modifiers |= type->base.modifiers;
- if (type->base.alignment > alignment)
- alignment = type->base.alignment;
const typedef_type_t *typedef_type = &type->typedeft;
if (typedef_type->resolved_type != NULL) {
const typedef_type_t *typedef_type = &type->typedeft;
if (typedef_type->resolved_type != NULL) {
@@
-1243,8
+1235,6
@@
type_t *skip_typeref(type_t *type)
case TYPE_TYPEOF: {
qualifiers |= type->base.qualifiers;
modifiers |= type->base.modifiers;
case TYPE_TYPEOF: {
qualifiers |= type->base.qualifiers;
modifiers |= type->base.modifiers;
- if (type->base.alignment > alignment)
- alignment = type->base.alignment;
const typeof_type_t *typeof_type = &type->typeoft;
if (typeof_type->typeof_type != NULL) {
const typeof_type_t *typeof_type = &type->typeoft;
if (typeof_type->typeof_type != NULL) {
@@
-1260,8
+1250,9
@@
type_t *skip_typeref(type_t *type)
break;
}
break;
}
- if (qualifiers != TYPE_QUALIFIER_NONE || modifiers != TYPE_MODIFIER_NONE
- || (alignment != 0 && alignment > type->base.alignment)) {
+ if (qualifiers != TYPE_QUALIFIER_NONE ||
+ modifiers != TYPE_MODIFIER_NONE ||
+ alignment > type->base.alignment) {
type_t *const copy = duplicate_type(type);
/* for const with typedefed array type the element type has to be
type_t *const copy = duplicate_type(type);
/* for const with typedefed array type the element type has to be
@@
-1279,10
+1270,7
@@
type_t *skip_typeref(type_t *type)
copy->base.alignment = alignment;
}
copy->base.alignment = alignment;
}
- type = typehash_insert(copy);
- if (type != copy) {
- obstack_free(type_obst, copy);
- }
+ type = identify_new_type(copy);
}
return type;
}
return type;
@@
-1422,7
+1410,7
@@
atomic_type_kind_t find_unsigned_int_atomic_type_kind_for_size(unsigned size) {
* Hash the given type and return the "singleton" version
* of it.
*/
* Hash the given type and return the "singleton" version
* of it.
*/
-
static
type_t *identify_new_type(type_t *type)
+type_t *identify_new_type(type_t *type)
{
type_t *result = typehash_insert(type);
if (result != type) {
{
type_t *result = typehash_insert(type);
if (result != type) {