1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Renamed StaticConstExpr() and StaticConstAbsIntExpr() with clearer comments.

This commit is contained in:
acqn 2020-08-30 00:26:52 +08:00
parent 492ee7fc45
commit 60c59f59a3
8 changed files with 37 additions and 37 deletions

View File

@ -135,7 +135,7 @@ static void ParseByteArg (StrBuf* T, unsigned Arg)
ConsumeComma ();
/* Evaluate the expression */
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
/* Check the range but allow negative values if the type is signed */
if (IsSignUnsigned (Expr.Type)) {
@ -168,7 +168,7 @@ static void ParseWordArg (StrBuf* T, unsigned Arg)
ConsumeComma ();
/* Evaluate the expression */
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
/* Check the range but allow negative values if the type is signed */
if (IsSignUnsigned (Expr.Type)) {
@ -201,7 +201,7 @@ static void ParseLongArg (StrBuf* T, unsigned Arg attribute ((unused)))
ConsumeComma ();
/* Evaluate the expression */
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
/* Convert into a hex number */
xsprintf (Buf, sizeof (Buf), "$%08lX", Expr.IVal & 0xFFFFFFFF);
@ -325,7 +325,7 @@ static void ParseStrArg (StrBuf* T, unsigned Arg attribute ((unused)))
break;
default:
Expr = StaticConstAbsIntExpr (hie1);
Expr = NoCodeConstAbsIntExpr (hie1);
xsprintf (Buf, sizeof (Buf), "%ld", Expr.IVal);
SB_AppendStr (T, Buf);
break;

View File

@ -622,7 +622,7 @@ static SymEntry* ParseEnumDecl (const char* Name)
if (CurTok.Tok == TOK_ASSIGN) {
NextToken ();
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
EnumVal = Expr.IVal;
MemberType = Expr.Type;
IsSigned = IsSignSigned (MemberType);
@ -772,7 +772,7 @@ static int ParseFieldWidth (Declaration* Decl)
/* Read the width */
NextToken ();
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
if (Expr.IVal < 0) {
Error ("Negative width in bit-field");
@ -1859,7 +1859,7 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode)
/* Read the size if it is given */
if (CurTok.Tok != TOK_RBRACK) {
ExprDesc Expr = StaticConstAbsIntExpr (hie1);
ExprDesc Expr = NoCodeConstAbsIntExpr (hie1);
if (Expr.IVal <= 0) {
if (D->Ident[0] != '\0') {
Error ("Size of array '%s' is invalid", D->Ident);
@ -2220,7 +2220,7 @@ static ExprDesc ParseScalarInitInternal (Type* T)
}
/* Get the expression and convert it to the target type */
ExprDesc ED = StaticConstExpr (hie1);
ExprDesc ED = NoCodeConstExpr (hie1);
TypeConversion (&ED, T);
/* Close eventually opening braces */
@ -2253,7 +2253,7 @@ static unsigned ParsePointerInit (Type* T)
unsigned BraceCount = OpeningCurlyBraces (0);
/* Expression */
ExprDesc ED = StaticConstExpr (hie1);
ExprDesc ED = NoCodeConstExpr (hie1);
TypeConversion (&ED, T);
/* Output the data */
@ -2598,7 +2598,7 @@ static unsigned ParseVoidInit (Type* T)
/* Allow an arbitrary list of values */
Size = 0;
do {
ExprDesc Expr = StaticConstExpr (hie1);
ExprDesc Expr = NoCodeConstExpr (hie1);
switch (GetUnderlyingTypeCode (&Expr.Type[0])) {
case T_SCHAR:

View File

@ -3150,14 +3150,14 @@ static void hieAndPP (ExprDesc* Expr)
** called recursively from the preprocessor.
*/
{
*Expr = StaticConstAbsIntExpr (hie2);
*Expr = NoCodeConstAbsIntExpr (hie2);
while (CurTok.Tok == TOK_BOOL_AND) {
/* Skip the && */
NextToken ();
/* Get rhs */
ExprDesc Expr2 = StaticConstAbsIntExpr (hie2);
ExprDesc Expr2 = NoCodeConstAbsIntExpr (hie2);
/* Combine the two */
Expr->IVal = (Expr->IVal && Expr2.IVal);
@ -3171,14 +3171,14 @@ static void hieOrPP (ExprDesc *Expr)
** called recursively from the preprocessor.
*/
{
*Expr = StaticConstAbsIntExpr (hieAndPP);
*Expr = NoCodeConstAbsIntExpr (hieAndPP);
while (CurTok.Tok == TOK_BOOL_OR) {
/* Skip the && */
NextToken ();
/* Get rhs */
ExprDesc Expr2 = StaticConstAbsIntExpr (hieAndPP);
ExprDesc Expr2 = NoCodeConstAbsIntExpr (hieAndPP);
/* Combine the two */
Expr->IVal = (Expr->IVal || Expr2.IVal);
@ -4047,11 +4047,11 @@ void BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr)
ExprDesc StaticConstExpr (void (*Func) (ExprDesc*))
/* Will evaluate an expression via the given function. If the result is not a
** static constant expression, a diagnostic will be printed, and the value is
** replaced by a constant one to make sure there are no internal errors that
** result from this input error.
ExprDesc NoCodeConstExpr (void (*Func) (ExprDesc*))
/* Get an expression evaluated via the given function. If the result is not a
** constant expression without runtime code generated, a diagnostic will be
** printed, and the value is replaced by a constant one to make sure there are
** no internal errors that result from this input error.
*/
{
ExprDesc Expr;
@ -4071,11 +4071,11 @@ ExprDesc StaticConstExpr (void (*Func) (ExprDesc*))
ExprDesc StaticConstAbsIntExpr (void (*Func) (ExprDesc*))
/* Will evaluate an expression via the given function. If the result is not a
** static constant numeric integer value, a diagnostic will be printed, and the
** value is replaced by a constant one to make sure there are no internal
** errors that result from this input error.
ExprDesc NoCodeConstAbsIntExpr (void (*Func) (ExprDesc*))
/* Get an expression evaluated via the given function. If the result is not a
** constant numeric integer value without runtime code generated, a diagnostic
** will be printed, and the value is replaced by a constant one to make sure
** there are no internal errors that result from this input error.
*/
{
ExprDesc Expr;

View File

@ -61,18 +61,18 @@ void BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr);
** are no internal errors that result from this input error.
*/
ExprDesc StaticConstExpr (void (*Func) (ExprDesc*));
ExprDesc NoCodeConstExpr (void (*Func) (ExprDesc*));
/* Get an expression evaluated via the given function. If the result is not a
** static constant expression, a diagnostic will be printed, and the value is
** replaced by a constant one to make sure there are no internal errors that
** result from this input error.
** constant expression without runtime code generated, a diagnostic will be
** printed, and the value is replaced by a constant one to make sure there are
** no internal errors that result from this input error.
*/
ExprDesc StaticConstAbsIntExpr (void (*Func) (ExprDesc*));
/* Get an expression evaluate via the given function. If the result is not a
** static constant numeric integer value, a diagnostic will be printed, and the
** value is replaced by a constant one to make sure there are no internal
** errors that result from this input error.
ExprDesc NoCodeConstAbsIntExpr (void (*Func) (ExprDesc*));
/* Get an expression evaluated via the given function. If the result is not a
** constant numeric integer value without runtime code generated, a diagnostic
** will be printed, and the value is replaced by a constant one to make sure
** there are no internal errors that result from this input error.
*/
void hie10 (ExprDesc* lval);

View File

@ -1076,7 +1076,7 @@ static int DoIf (int Skip)
NextToken ();
/* Call the expression parser */
ExprDesc Expr = StaticConstExpr (hie1);
ExprDesc Expr = NoCodeConstExpr (hie1);
/* End preprocessing mode */
Preprocessing = 0;

View File

@ -44,7 +44,7 @@
/* Set when the preprocessor calls StaticConstExpr() recursively */
/* Set when the preprocessor calls NoCodeConstExpr() recursively */
extern unsigned char Preprocessing;

View File

@ -65,7 +65,7 @@ void ParseStaticAssert ()
}
/* Parse assertion condition */
Expr = StaticConstAbsIntExpr (hie1);
Expr = NoCodeConstAbsIntExpr (hie1);
failed = !Expr.IVal;
/* If there is a comma, we also have an error message. The message is optional because we

View File

@ -216,7 +216,7 @@ void CaseLabel (void)
NextToken ();
/* Read the selector expression */
CaseExpr = StaticConstAbsIntExpr (hie1);
CaseExpr = NoCodeConstAbsIntExpr (hie1);
Val = CaseExpr.IVal;
/* Now check if we're inside a switch statement */