mirror of
https://github.com/cc65/cc65.git
synced 2025-08-09 13:25:06 +00:00
Changed parameter constness of TypeConversion().
This commit is contained in:
@@ -1009,6 +1009,20 @@ Type* Indirect (Type* T)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const Type* IndirectConst (const Type* T)
|
||||||
|
/* Do one indirection for the given type, that is, return the type where the
|
||||||
|
** given type points to.
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
/* We are expecting a pointer expression */
|
||||||
|
CHECK (IsClassPtr (T));
|
||||||
|
|
||||||
|
/* Skip the pointer or array token itself */
|
||||||
|
return T + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Type* ArrayToPtr (Type* T)
|
Type* ArrayToPtr (Type* T)
|
||||||
/* Convert an array to a pointer to it's first element */
|
/* Convert an array to a pointer to it's first element */
|
||||||
{
|
{
|
||||||
|
@@ -345,6 +345,11 @@ Type* Indirect (Type* T);
|
|||||||
** given type points to.
|
** given type points to.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const Type* IndirectConst (const Type* T);
|
||||||
|
/* Do one indirection for the given type, that is, return the type where the
|
||||||
|
** given type points to.
|
||||||
|
*/
|
||||||
|
|
||||||
Type* ArrayToPtr (Type* T);
|
Type* ArrayToPtr (Type* T);
|
||||||
/* Convert an array to a pointer to it's first element */
|
/* Convert an array to a pointer to it's first element */
|
||||||
|
|
||||||
|
@@ -192,7 +192,7 @@ ExitPoint:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TypeConversion (ExprDesc* Expr, Type* NewType)
|
void TypeConversion (ExprDesc* Expr, const Type* NewType)
|
||||||
/* Do an automatic conversion of the given expression to the new type. Output
|
/* Do an automatic conversion of the given expression to the new type. Output
|
||||||
** warnings or errors where this automatic conversion is suspicious or
|
** warnings or errors where this automatic conversion is suspicious or
|
||||||
** impossible.
|
** impossible.
|
||||||
@@ -264,7 +264,7 @@ void TypeConversion (ExprDesc* Expr, Type* NewType)
|
|||||||
** - the rhs pointer is a void pointer, or
|
** - the rhs pointer is a void pointer, or
|
||||||
** - the lhs pointer is a void pointer.
|
** - the lhs pointer is a void pointer.
|
||||||
*/
|
*/
|
||||||
if (!IsTypeVoid (Indirect (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) {
|
if (!IsTypeVoid (IndirectConst (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) {
|
||||||
/* Compare the types */
|
/* Compare the types */
|
||||||
switch (TypeCmp (NewType, Expr->Type)) {
|
switch (TypeCmp (NewType, Expr->Type)) {
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
void TypeCompatibilityDiagnostic (const Type* NewType, const Type* OldType, int IsError, const char* Msg);
|
void TypeCompatibilityDiagnostic (const Type* NewType, const Type* OldType, int IsError, const char* Msg);
|
||||||
/* Print error or warning message about type conversion with proper type names */
|
/* Print error or warning message about type conversion with proper type names */
|
||||||
|
|
||||||
void TypeConversion (ExprDesc* Expr, Type* NewType);
|
void TypeConversion (ExprDesc* Expr, const Type* NewType);
|
||||||
/* Do an automatic conversion of the given expression to the new type. Output
|
/* Do an automatic conversion of the given expression to the new type. Output
|
||||||
** warnings or errors where this automatic conversion is suspicious or
|
** warnings or errors where this automatic conversion is suspicious or
|
||||||
** impossible.
|
** impossible.
|
||||||
|
Reference in New Issue
Block a user