|
@@ -227,10 +227,10 @@ static CPToken cp_param(CPState *cp)
|
|
|
GCcdata *cd;
|
|
|
if (!tviscdata(o)) lj_err_argtype(cp->L, o-cp->L->base+1, "type parameter");
|
|
|
cd = cdataV(o);
|
|
|
- if (cd->typeid == CTID_CTYPEID)
|
|
|
+ if (cd->ctypeid == CTID_CTYPEID)
|
|
|
cp->val.id = *(CTypeID *)cdataptr(cd);
|
|
|
else
|
|
|
- cp->val.id = cd->typeid;
|
|
|
+ cp->val.id = cd->ctypeid;
|
|
|
return '$';
|
|
|
}
|
|
|
}
|
|
@@ -970,16 +970,16 @@ static void cp_decl_reset(CPDecl *decl)
|
|
|
|
|
|
/* Parse constant initializer. */
|
|
|
/* NYI: FP constants and strings as initializers. */
|
|
|
-static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid)
|
|
|
+static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID ctypeid)
|
|
|
{
|
|
|
- CType *ctt = ctype_get(cp->cts, typeid);
|
|
|
+ CType *ctt = ctype_get(cp->cts, ctypeid);
|
|
|
CTInfo info;
|
|
|
CTSize size;
|
|
|
CPValue k;
|
|
|
CTypeID constid;
|
|
|
while (ctype_isattrib(ctt->info)) { /* Skip attributes. */
|
|
|
- typeid = ctype_cid(ctt->info); /* Update ID, too. */
|
|
|
- ctt = ctype_get(cp->cts, typeid);
|
|
|
+ ctypeid = ctype_cid(ctt->info); /* Update ID, too. */
|
|
|
+ ctt = ctype_get(cp->cts, ctypeid);
|
|
|
}
|
|
|
info = ctt->info;
|
|
|
size = ctt->size;
|
|
@@ -988,7 +988,7 @@ static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid)
|
|
|
cp_check(cp, '=');
|
|
|
cp_expr_sub(cp, &k, 0);
|
|
|
constid = lj_ctype_new(cp->cts, ctp);
|
|
|
- (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|typeid);
|
|
|
+ (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|ctypeid);
|
|
|
k.u32 <<= 8*(4-size);
|
|
|
if ((info & CTF_UNSIGNED))
|
|
|
k.u32 >>= 8*(4-size);
|
|
@@ -1352,18 +1352,18 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo)
|
|
|
CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT|CPARSE_MODE_FIELD;
|
|
|
|
|
|
for (;;) {
|
|
|
- CTypeID typeid;
|
|
|
+ CTypeID ctypeid;
|
|
|
|
|
|
if (lastdecl) cp_err_token(cp, '}');
|
|
|
|
|
|
/* Parse field declarator. */
|
|
|
decl.bits = CTSIZE_INVALID;
|
|
|
cp_declarator(cp, &decl);
|
|
|
- typeid = cp_decl_intern(cp, &decl);
|
|
|
+ ctypeid = cp_decl_intern(cp, &decl);
|
|
|
|
|
|
if ((scl & CDF_STATIC)) { /* Static constant in struct namespace. */
|
|
|
CType *ct;
|
|
|
- CTypeID fieldid = cp_decl_constinit(cp, &ct, typeid);
|
|
|
+ CTypeID fieldid = cp_decl_constinit(cp, &ct, ctypeid);
|
|
|
ctype_get(cp->cts, lastid)->sib = fieldid;
|
|
|
lastid = fieldid;
|
|
|
ctype_setname(ct, decl.name);
|
|
@@ -1371,7 +1371,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo)
|
|
|
CTSize bsz = CTBSZ_FIELD; /* Temp. for layout phase. */
|
|
|
CType *ct;
|
|
|
CTypeID fieldid = lj_ctype_new(cp->cts, &ct); /* Do this first. */
|
|
|
- CType *tct = ctype_raw(cp->cts, typeid);
|
|
|
+ CType *tct = ctype_raw(cp->cts, ctypeid);
|
|
|
|
|
|
if (decl.bits == CTSIZE_INVALID) { /* Regular field. */
|
|
|
if (ctype_isarray(tct->info) && tct->size == CTSIZE_INVALID)
|
|
@@ -1382,7 +1382,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo)
|
|
|
if (!((ctype_isstruct(tct->info) && !(tct->info & CTF_VLA)) ||
|
|
|
ctype_isenum(tct->info)))
|
|
|
cp_err_token(cp, CTOK_IDENT);
|
|
|
- ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + typeid);
|
|
|
+ ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + ctypeid);
|
|
|
ct->size = ctype_isstruct(tct->info) ?
|
|
|
(decl.attr|0x80000000u) : 0; /* For layout phase. */
|
|
|
goto add_field;
|
|
@@ -1396,7 +1396,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo)
|
|
|
}
|
|
|
|
|
|
/* Create temporary field for layout phase. */
|
|
|
- ct->info = CTINFO(CT_FIELD, typeid + (bsz << CTSHIFT_BITCSZ));
|
|
|
+ ct->info = CTINFO(CT_FIELD, ctypeid + (bsz << CTSHIFT_BITCSZ));
|
|
|
ct->size = decl.attr;
|
|
|
if (decl.name) ctype_setname(ct, decl.name);
|
|
|
|
|
@@ -1601,7 +1601,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl)
|
|
|
if (cp->tok != ')') {
|
|
|
do {
|
|
|
CPDecl decl;
|
|
|
- CTypeID typeid, fieldid;
|
|
|
+ CTypeID ctypeid, fieldid;
|
|
|
CType *ct;
|
|
|
if (cp_opt(cp, '.')) { /* Vararg function. */
|
|
|
cp_check(cp, '.'); /* Workaround for the minimalistic lexer. */
|
|
@@ -1612,16 +1612,16 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl)
|
|
|
cp_decl_spec(cp, &decl, CDF_REGISTER);
|
|
|
decl.mode = CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT;
|
|
|
cp_declarator(cp, &decl);
|
|
|
- typeid = cp_decl_intern(cp, &decl);
|
|
|
- ct = ctype_raw(cp->cts, typeid);
|
|
|
+ ctypeid = cp_decl_intern(cp, &decl);
|
|
|
+ ct = ctype_raw(cp->cts, ctypeid);
|
|
|
if (ctype_isvoid(ct->info))
|
|
|
break;
|
|
|
else if (ctype_isrefarray(ct->info))
|
|
|
- typeid = lj_ctype_intern(cp->cts,
|
|
|
+ ctypeid = lj_ctype_intern(cp->cts,
|
|
|
CTINFO(CT_PTR, CTALIGN_PTR|ctype_cid(ct->info)), CTSIZE_PTR);
|
|
|
else if (ctype_isfunc(ct->info))
|
|
|
- typeid = lj_ctype_intern(cp->cts,
|
|
|
- CTINFO(CT_PTR, CTALIGN_PTR|typeid), CTSIZE_PTR);
|
|
|
+ ctypeid = lj_ctype_intern(cp->cts,
|
|
|
+ CTINFO(CT_PTR, CTALIGN_PTR|ctypeid), CTSIZE_PTR);
|
|
|
/* Add new parameter. */
|
|
|
fieldid = lj_ctype_new(cp->cts, &ct);
|
|
|
if (anchor)
|
|
@@ -1630,7 +1630,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl)
|
|
|
anchor = fieldid;
|
|
|
lastid = fieldid;
|
|
|
if (decl.name) ctype_setname(ct, decl.name);
|
|
|
- ct->info = CTINFO(CT_FIELD, typeid);
|
|
|
+ ct->info = CTINFO(CT_FIELD, ctypeid);
|
|
|
ct->size = nargs++;
|
|
|
} while (cp_opt(cp, ','));
|
|
|
}
|
|
@@ -1794,28 +1794,28 @@ static void cp_decl_multi(CPState *cp)
|
|
|
goto decl_end; /* Accept empty declaration of struct/union/enum. */
|
|
|
}
|
|
|
for (;;) {
|
|
|
- CTypeID typeid;
|
|
|
+ CTypeID ctypeid;
|
|
|
cp_declarator(cp, &decl);
|
|
|
- typeid = cp_decl_intern(cp, &decl);
|
|
|
+ ctypeid = cp_decl_intern(cp, &decl);
|
|
|
if (decl.name && !decl.nameid) { /* NYI: redeclarations are ignored. */
|
|
|
CType *ct;
|
|
|
CTypeID id;
|
|
|
if ((scl & CDF_TYPEDEF)) { /* Create new typedef. */
|
|
|
id = lj_ctype_new(cp->cts, &ct);
|
|
|
- ct->info = CTINFO(CT_TYPEDEF, typeid);
|
|
|
+ ct->info = CTINFO(CT_TYPEDEF, ctypeid);
|
|
|
goto noredir;
|
|
|
- } else if (ctype_isfunc(ctype_get(cp->cts, typeid)->info)) {
|
|
|
+ } else if (ctype_isfunc(ctype_get(cp->cts, ctypeid)->info)) {
|
|
|
/* Treat both static and extern function declarations as extern. */
|
|
|
- ct = ctype_get(cp->cts, typeid);
|
|
|
+ ct = ctype_get(cp->cts, ctypeid);
|
|
|
/* We always get new anonymous functions (typedefs are copied). */
|
|
|
lua_assert(gcref(ct->name) == NULL);
|
|
|
- id = typeid; /* Just name it. */
|
|
|
+ id = ctypeid; /* Just name it. */
|
|
|
} else if ((scl & CDF_STATIC)) { /* Accept static constants. */
|
|
|
- id = cp_decl_constinit(cp, &ct, typeid);
|
|
|
+ id = cp_decl_constinit(cp, &ct, ctypeid);
|
|
|
goto noredir;
|
|
|
} else { /* External references have extern or no storage class. */
|
|
|
id = lj_ctype_new(cp->cts, &ct);
|
|
|
- ct->info = CTINFO(CT_EXTERN, typeid);
|
|
|
+ ct->info = CTINFO(CT_EXTERN, ctypeid);
|
|
|
}
|
|
|
if (decl.redir) { /* Add attribute for redirected symbol name. */
|
|
|
CType *cta;
|