1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-11 11:30:13 +00:00

Fixed getting the basic raw type names.

This commit is contained in:
acqn 2020-08-13 08:24:40 +08:00 committed by Oliver Schmidt
parent 11cd3e5cbd
commit 15f28c3a8c
2 changed files with 23 additions and 3 deletions

View File

@ -235,7 +235,7 @@ const char* GetBasicTypeName (const Type* T)
default: break; default: break;
} }
if (IsClassInt (T)) { if (IsClassInt (T)) {
if (IsSignSigned (T)) { if (IsRawSignSigned (T)) {
switch (GetRawType (T)) { switch (GetRawType (T)) {
case T_TYPE_CHAR: return "signed char"; case T_TYPE_CHAR: return "signed char";
case T_TYPE_SHORT: return "short"; case T_TYPE_SHORT: return "short";
@ -245,7 +245,7 @@ const char* GetBasicTypeName (const Type* T)
default: default:
return "signed integer"; return "signed integer";
} }
} else if (IsSignUnsigned (T)) { } else if (IsRawSignUnsigned (T)) {
switch (GetRawType (T)) { switch (GetRawType (T)) {
case T_TYPE_CHAR: return "unsigned char"; case T_TYPE_CHAR: return "unsigned char";
case T_TYPE_SHORT: return "unsigned short"; case T_TYPE_SHORT: return "unsigned short";

View File

@ -652,6 +652,16 @@ INLINE TypeCode GetSignedness (const Type* T)
# define GetSignedness(T) (GetUnderlyingTypeCode (T) & T_MASK_SIGN) # define GetSignedness(T) (GetUnderlyingTypeCode (T) & T_MASK_SIGN)
#endif #endif
#if defined(HAVE_INLINE)
INLINE int IsRawSignUnsigned (const Type* T)
/* Return true if this is an unsigned raw type */
{
return (GetRawSignedness (T) == T_SIGN_UNSIGNED);
}
#else
# define IsRawSignUnsigned(T) (GetRawSignedness (T) == T_SIGN_UNSIGNED)
#endif
#if defined(HAVE_INLINE) #if defined(HAVE_INLINE)
INLINE int IsSignUnsigned (const Type* T) INLINE int IsSignUnsigned (const Type* T)
/* Return true if this is an unsigned type */ /* Return true if this is an unsigned type */
@ -662,6 +672,16 @@ INLINE int IsSignUnsigned (const Type* T)
# define IsSignUnsigned(T) (GetSignedness (T) == T_SIGN_UNSIGNED) # define IsSignUnsigned(T) (GetSignedness (T) == T_SIGN_UNSIGNED)
#endif #endif
#if defined(HAVE_INLINE)
INLINE int IsRawSignSigned (const Type* T)
/* Return true if this is a signed raw type */
{
return (GetRawSignedness (T) == T_SIGN_SIGNED);
}
#else
# define IsRawSignSigned(T) (GetRawSignedness (T) == T_SIGN_SIGNED)
#endif
#if defined(HAVE_INLINE) #if defined(HAVE_INLINE)
INLINE int IsSignSigned (const Type* T) INLINE int IsSignSigned (const Type* T)
/* Return true if this is a signed type */ /* Return true if this is a signed type */
@ -673,7 +693,7 @@ INLINE int IsSignSigned (const Type* T)
#endif #endif
#if defined(HAVE_INLINE) #if defined(HAVE_INLINE)
INLINE TypeCode GetRawSizeModifier(const Type* T) INLINE TypeCode GetRawSizeModifier (const Type* T)
/* Get the size modifier of a raw type */ /* Get the size modifier of a raw type */
{ {
return (T->C & T_MASK_SIZE); return (T->C & T_MASK_SIZE);