mirror of
https://github.com/cc65/cc65.git
synced 2025-02-09 17:33:00 +00:00
The code for compares with a constant result may not be removed, because it
may contain side effects. git-svn-id: svn://svn.cc65.org/cc65/trunk@5010 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
a507605a89
commit
80a5686bd9
@ -2076,7 +2076,9 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Comparing a char against a constant may have a constant
|
/* Comparing a char against a constant may have a constant
|
||||||
* result.
|
* result. Please note: It is not possible to remove the code
|
||||||
|
* for the compare alltogether, because it may have side
|
||||||
|
* effects.
|
||||||
*/
|
*/
|
||||||
switch (Tok) {
|
switch (Tok) {
|
||||||
|
|
||||||
@ -2084,7 +2086,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal < LeftMin || Expr2.IVal > LeftMax) {
|
if (Expr2.IVal < LeftMin || Expr2.IVal > LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, 0);
|
ED_MakeConstAbsInt (Expr, 0);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2093,7 +2094,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal < LeftMin || Expr2.IVal > LeftMax) {
|
if (Expr2.IVal < LeftMin || Expr2.IVal > LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, 1);
|
ED_MakeConstAbsInt (Expr, 1);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2102,7 +2102,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal <= LeftMin || Expr2.IVal > LeftMax) {
|
if (Expr2.IVal <= LeftMin || Expr2.IVal > LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, Expr2.IVal > LeftMax);
|
ED_MakeConstAbsInt (Expr, Expr2.IVal > LeftMax);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2111,7 +2110,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal < LeftMin || Expr2.IVal >= LeftMax) {
|
if (Expr2.IVal < LeftMin || Expr2.IVal >= LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, Expr2.IVal >= LeftMax);
|
ED_MakeConstAbsInt (Expr, Expr2.IVal >= LeftMax);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2120,7 +2118,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal <= LeftMin || Expr2.IVal > LeftMax) {
|
if (Expr2.IVal <= LeftMin || Expr2.IVal > LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, Expr2.IVal <= LeftMin);
|
ED_MakeConstAbsInt (Expr, Expr2.IVal <= LeftMin);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2129,7 +2126,6 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */
|
|||||||
if (Expr2.IVal < LeftMin || Expr2.IVal >= LeftMax) {
|
if (Expr2.IVal < LeftMin || Expr2.IVal >= LeftMax) {
|
||||||
ED_MakeConstAbsInt (Expr, Expr2.IVal < LeftMin);
|
ED_MakeConstAbsInt (Expr, Expr2.IVal < LeftMin);
|
||||||
WarnConstCompareResult ();
|
WarnConstCompareResult ();
|
||||||
RemoveCode (&Mark0);
|
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user