/* don't perform integer promotion of explicitly typecasted variable arguments
* if sdcc extensions are enabled */
- if (options.std_sdcc &&
+ if (options.std_sdcc &&
(IS_CAST_OP (*actParm) ||
(IS_AST_SYM_VALUE (*actParm) && AST_VALUES (*actParm, removedCast)) ||
(IS_AST_LIT_VALUE (*actParm) && AST_VALUES (*actParm, literalFromCast))))
/* createIvalStruct - generates initial value for structures */
/*-----------------------------------------------------------------*/
static ast *
-createIvalStruct (ast * sym, sym_link * type, initList * ilist, ast *rootValue)
+createIvalStruct (ast *sym, sym_link *type, initList *ilist, ast *rootValue)
{
ast *rast = NULL;
ast *lAst;
initList *iloop;
sym_link * etype = getSpec (type);
- sflds = SPEC_STRUCT (type)->fields;
if (ilist && ilist->type != INIT_DEEP)
{
werror (E_INIT_STRUCT, "");
iloop = ilist ? ilist->init.deep : NULL;
- for (; sflds; sflds = sflds->next, iloop = (iloop ? iloop->next : NULL))
+ for (sflds = SPEC_STRUCT (type)->fields; sflds; sflds = sflds->next)
{
/* if we have come to end */
if (!iloop && (!AST_SYMBOL (rootValue)->islocal || SPEC_STAT (etype)))
+ break;
+
+ if (!IS_BITFIELD (sflds->type) || !SPEC_BUNNAMED (sflds->etype))
{
- break;
+ sflds->implicit = 1;
+ lAst = newNode (PTR_OP, newNode ('&', sym, NULL), newAst_VALUE (symbolVal (sflds)));
+ lAst = decorateType (resolveSymbols (lAst), RESULT_TYPE_NONE);
+ rast = decorateType (resolveSymbols (createIval (lAst, sflds->type, iloop, rast, rootValue)), RESULT_TYPE_NONE);
+ iloop = iloop ? iloop->next : NULL;
}
-
- sflds->implicit = 1;
- lAst = newNode (PTR_OP, newNode ('&', sym, NULL), newAst_VALUE (symbolVal (sflds)));
- lAst = decorateType (resolveSymbols (lAst), RESULT_TYPE_NONE);
- rast = decorateType (resolveSymbols (createIval (lAst, sflds->type,
- iloop, rast, rootValue)),
- RESULT_TYPE_NONE);
}
if (iloop)
sym->opval.val->sym->name);
else
werrorfl (sym->filename, sym->lineno, E_INIT_COUNT);
- }
+ }
return rast;
}
if (!AST_SYMBOL (rootVal)->islocal || SPEC_STAT (getSpec (type)))
return NULL;
- for (i=0; i<symsize; i++)
+ for (i = 0; i < symsize; ++i)
{
rast = newNode (NULLOP,
rast,
unsigned int symsize = getSize (type);
size = getSize (iexpr->ftype);
- if (symsize && size>symsize)
+ if (symsize && size > symsize)
{
- if (size>(symsize+1))
+ if (size > symsize)
{
char *name = (IS_AST_SYM_VALUE(sym)) ? AST_SYMBOL(sym)->name : "";
size = symsize;
}
- for (i=0;i<size;i++)
+ for (i = 0; i < size; i++)
{
rast = newNode (NULLOP,
rast,
newNode ('=',
newNode ('[', sym,
newAst_VALUE (valueFromLit ((float) i))),
- newAst_VALUE (valueFromLit (*s))));
- s++;
+ newAst_VALUE (valueFromLit (*s++))));
}
// now WE don't need iexpr's symbol anymore