#include "litpool.h"
#include "scanner.h"
#include "stdfunc.h"
+#include "stdnames.h"
#include "typeconv.h"
unsigned Flags = CF_FORCECHAR;
/* Read the expression we're going to pass to the function */
- int k = hie1 (InitExprDesc (Arg));
+ hie1 (InitExprDesc (Arg));
/* Convert this expression to the expected type */
- k = TypeConversion (Arg, k, Type);
+ TypeConversion (Arg, Type);
/* If the value is not a constant, load it into the primary */
- if (k != 0 || Arg->Flags != E_MCONST) {
+ if (ED_IsLVal (Arg) || Arg->Flags != E_MCONST) {
/* Load into the primary */
- ExprLoad (CF_NONE, k, Arg);
- k = 0;
+ ExprLoad (CF_NONE, Arg);
+ ED_MakeRVal (Arg);
} else {
if (Arg.ConstVal == 0) {
Warning ("Call to memset has no effect");
}
- ExprLoad (CF_FORCECHAR, 0, &Arg);
+ ExprLoad (CF_FORCECHAR, &Arg);
}
/* Emit the actual function call */
- g_call (CF_NONE, MemSet? "memset" : "_bzero", ParamSize);
+ g_call (CF_NONE, MemSet? Func_memset : Func__bzero, ParamSize);
/* We expect the closing brace */
ConsumeRParen ();
/* Handle the strlen function */
{
static type ParamType[] = { T_PTR, T_SCHAR, T_END };
- int k;
ExprDesc Param;
unsigned CodeFlags;
unsigned long ParamName;
ParamType[1] = GetDefaultChar () | T_QUAL_CONST;
/* Fetch the parameter and convert it to the type needed */
- k = TypeConversion (&Param, hie1 (InitExprDesc (&Param)), ParamType);
+ hie1 (InitExprDesc (&Param));
+ TypeConversion (&Param, ParamType);
/* Check if the parameter is a constant array of some type, or a numeric
* address cast to a pointer.
if (!WriteableStrings) {
/* String literals are const */
ExprDesc Length;
- MakeConstIntExpr (&Length, strlen (GetLiteral (Param.ConstVal)));
+ ED_MakeConstInt (&Length, strlen (GetLiteral (Param.ConstVal)));
ResetLiteralPoolOffs (Param.ConstVal);
- ExprLoad (CF_NONE, 0, &Length);
+ ExprLoad (CF_NONE, &Length);
goto ExitPoint;
} else {
CodeFlags |= CF_CONST | CF_STATIC;
} else {
/* Not an array with a constant address. Load parameter into primary */
- ExprLoad (CF_NONE, k, &Param);
+ ExprLoad (CF_NONE, &Param);
}