mirror of
https://github.com/cc65/cc65.git
synced 2025-02-11 00:31:06 +00:00
Merge pull request #2236 from acqn/TypeFix
[cc65] Fixed some type-related bugs which don't have any impact yet
This commit is contained in:
commit
f381d23001
@ -63,6 +63,8 @@
|
|||||||
const Type type_char[] = { TYPE(T_CHAR), TYPE(T_END) };
|
const Type type_char[] = { TYPE(T_CHAR), TYPE(T_END) };
|
||||||
const Type type_schar[] = { TYPE(T_SCHAR), TYPE(T_END) };
|
const Type type_schar[] = { TYPE(T_SCHAR), TYPE(T_END) };
|
||||||
const Type type_uchar[] = { TYPE(T_UCHAR), TYPE(T_END) };
|
const Type type_uchar[] = { TYPE(T_UCHAR), TYPE(T_END) };
|
||||||
|
const Type type_short[] = { TYPE(T_SHORT), TYPE(T_END) };
|
||||||
|
const Type type_ushort[] = { TYPE(T_USHORT), TYPE(T_END) };
|
||||||
const Type type_int[] = { TYPE(T_INT), TYPE(T_END) };
|
const Type type_int[] = { TYPE(T_INT), TYPE(T_END) };
|
||||||
const Type type_uint[] = { TYPE(T_UINT), TYPE(T_END) };
|
const Type type_uint[] = { TYPE(T_UINT), TYPE(T_END) };
|
||||||
const Type type_long[] = { TYPE(T_LONG), TYPE(T_END) };
|
const Type type_long[] = { TYPE(T_LONG), TYPE(T_END) };
|
||||||
@ -315,7 +317,7 @@ unsigned CheckedSizeOf (const Type* T)
|
|||||||
{
|
{
|
||||||
unsigned Size = SizeOf (T);
|
unsigned Size = SizeOf (T);
|
||||||
if (Size == 0) {
|
if (Size == 0) {
|
||||||
if (HasUnknownSize (T + 1)) {
|
if (HasUnknownSize (T)) {
|
||||||
Error ("Size of type '%s' is unknown", GetFullTypeName (T));
|
Error ("Size of type '%s' is unknown", GetFullTypeName (T));
|
||||||
} else {
|
} else {
|
||||||
Error ("Size of type '%s' is 0", GetFullTypeName (T));
|
Error ("Size of type '%s' is 0", GetFullTypeName (T));
|
||||||
@ -727,8 +729,10 @@ const Type* GetSignedType (const Type* T)
|
|||||||
case T_RANK_CHAR:
|
case T_RANK_CHAR:
|
||||||
return type_schar;
|
return type_schar;
|
||||||
|
|
||||||
case T_RANK_INT:
|
|
||||||
case T_RANK_SHORT:
|
case T_RANK_SHORT:
|
||||||
|
return type_short;
|
||||||
|
|
||||||
|
case T_RANK_INT:
|
||||||
return type_int;
|
return type_int;
|
||||||
|
|
||||||
case T_RANK_LONG:
|
case T_RANK_LONG:
|
||||||
@ -749,8 +753,10 @@ const Type* GetUnsignedType (const Type* T)
|
|||||||
case T_RANK_CHAR:
|
case T_RANK_CHAR:
|
||||||
return type_uchar;
|
return type_uchar;
|
||||||
|
|
||||||
case T_RANK_INT:
|
|
||||||
case T_RANK_SHORT:
|
case T_RANK_SHORT:
|
||||||
|
return type_ushort;
|
||||||
|
|
||||||
|
case T_RANK_INT:
|
||||||
return type_uint;
|
return type_uint;
|
||||||
|
|
||||||
case T_RANK_LONG:
|
case T_RANK_LONG:
|
||||||
@ -1016,7 +1022,11 @@ int HasUnknownSize (const Type* T)
|
|||||||
int TypeHasAttrData (const Type* T)
|
int TypeHasAttrData (const Type* T)
|
||||||
/* Return true if the given type has attribute data */
|
/* Return true if the given type has attribute data */
|
||||||
{
|
{
|
||||||
return IsClassStruct (T) || IsTypeArray (T) || IsClassFunc (T);
|
return IsClassStruct (T) ||
|
||||||
|
IsTypeArray (T) ||
|
||||||
|
IsClassFunc (T) ||
|
||||||
|
IsTypeVoid (T) ||
|
||||||
|
IsTypeBitField (T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,6 +215,8 @@ struct Type {
|
|||||||
extern const Type type_char[];
|
extern const Type type_char[];
|
||||||
extern const Type type_schar[];
|
extern const Type type_schar[];
|
||||||
extern const Type type_uchar[];
|
extern const Type type_uchar[];
|
||||||
|
extern const Type type_short[];
|
||||||
|
extern const Type type_ushort[];
|
||||||
extern const Type type_int[];
|
extern const Type type_int[];
|
||||||
extern const Type type_uint[];
|
extern const Type type_uint[];
|
||||||
extern const Type type_long[];
|
extern const Type type_long[];
|
||||||
|
@ -759,7 +759,7 @@ static SymEntry* ParseEnumSpec (const char* Name, unsigned* DSFlags)
|
|||||||
Flags |= SC_FICTITIOUS;
|
Flags |= SC_FICTITIOUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return AddEnumSym (Name, Flags, MemberType, FieldTab, DSFlags);
|
return AddEnumSym (Name, SC_DEF | Flags, MemberType, FieldTab, DSFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user