diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2010-05-26 23:29:16 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-29 16:30:53 +0100 |
commit | 40891b978c7361e132994b9ae0f7be52589189e5 (patch) | |
tree | fe2ba4b39f3a467461caed464304058b720c3fa4 /bcc | |
parent | 1341b94d6609468c1816a94c6cee40e69ba2da90 (diff) | |
download | dev86-40891b978c7361e132994b9ae0f7be52589189e5.tar.gz |
In K&R C lvalues remain lvalues even after cast
Diffstat (limited to 'bcc')
-rw-r--r-- | bcc/express.c | 7 | ||||
-rw-r--r-- | bcc/exptree.c | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/bcc/express.c b/bcc/express.c index f57db0a..bceff0e 100644 --- a/bcc/express.c +++ b/bcc/express.c @@ -43,7 +43,12 @@ PRIVATE struct nodestruct *cast_exp() if (vartype->scalar & INT && scalar & (CHAR | SHORT | INT) && !((vartype->scalar ^ scalar) & UNSIGNED)) { - nodeptr->flags &= ~LVALUE; +/* No ancient switch on low mem systems */ +#ifndef VERY_SMALL_MEMORY + /* In ancient UNIX C, casts remain lvalues */ + if (!ancient) +#endif + nodeptr->flags &= ~LVALUE; return nodeptr; /* skip casts that are default promotions */ } return castnode(vartype, nodeptr); diff --git a/bcc/exptree.c b/bcc/exptree.c index 04a4534..c5cc09f 100644 --- a/bcc/exptree.c +++ b/bcc/exptree.c @@ -358,7 +358,12 @@ struct nodestruct *p2; needspv(p2); if (p1->nodetype == p2->nodetype) { - p1->flags &= ~LVALUE; +/* No ancient switch on low mem systems */ +#ifndef VERY_SMALL_MEMORY + /* In ancient UNIX C, casts remain lvalues */ + if (!ancient) +#endif + p1->flags &= ~LVALUE; return p1; } if ((rscalar = p2->nodetype->scalar) & ISCALAR) @@ -455,7 +460,12 @@ struct nodestruct *p2; } else goto node1; - p1->flags &= ~LVALUE; +/* No ancient switch on low mem systems */ +#ifndef VERY_SMALL_MEMORY + /* In ancient UNIX C, casts remain lvalues */ + if (!ancient) +#endif + p1->flags &= ~LVALUE; p1->nodetype = target->type = p2->nodetype; return p1; case INDIRECTOP: |