mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 17:30:50 +00:00
Made the code handling '&expression' slightly tidier.
This commit is contained in:
parent
3c52ad1d9e
commit
62a6e37487
@ -1867,23 +1867,23 @@ void hie10 (ExprDesc* Expr)
|
|||||||
NextToken ();
|
NextToken ();
|
||||||
ExprWithCheck (hie10, Expr);
|
ExprWithCheck (hie10, Expr);
|
||||||
/* The & operator may be applied to any lvalue, and it may be
|
/* The & operator may be applied to any lvalue, and it may be
|
||||||
** applied to functions, even if they're no lvalues.
|
** applied to functions and arrays, even if they're not lvalues.
|
||||||
*/
|
*/
|
||||||
if (ED_IsRVal (Expr) && !IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) {
|
if (!IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) {
|
||||||
Error ("Illegal address");
|
if (ED_IsRVal (Expr)) {
|
||||||
} else {
|
Error ("Illegal address");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (ED_IsBitField (Expr)) {
|
if (ED_IsBitField (Expr)) {
|
||||||
Error ("Cannot take address of bit-field");
|
Error ("Cannot take address of bit-field");
|
||||||
/* Do it anyway, just to avoid further warnings */
|
/* Do it anyway, just to avoid further warnings */
|
||||||
Expr->Flags &= ~E_BITFIELD;
|
ED_DisBitField (Expr);
|
||||||
}
|
}
|
||||||
/* It's allowed in C to take the address of an array this way */
|
/* The & operator yields an rvalue address */
|
||||||
if (!IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) {
|
ED_AddrExpr (Expr);
|
||||||
/* The & operator yields an rvalue address */
|
|
||||||
ED_AddrExpr (Expr);
|
|
||||||
}
|
|
||||||
Expr->Type = PointerTo (Expr->Type);
|
|
||||||
}
|
}
|
||||||
|
Expr->Type = PointerTo (Expr->Type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOK_SIZEOF:
|
case TOK_SIZEOF:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user