diff options
author | Mike Pall <mike> | 2012-07-03 13:19:32 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2012-07-03 13:19:32 +0200 |
commit | 17d3fc47f30f8d8e62231252ce41f4feba71aa2f (patch) | |
tree | 6134124f9357a0f4ca821556de644337491e4e0b /src/lj_cparse.c | |
parent | c740a302238cf650dd7fef6ebed8aeb878cf0c1d (diff) | |
download | luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.tar.gz luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.tar.bz2 luajit-17d3fc47f30f8d8e62231252ce41f4feba71aa2f.zip |
Avoid pesky compiler warnings about C++ keywords (eh?).
Diffstat (limited to 'src/lj_cparse.c')
-rw-r--r-- | src/lj_cparse.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lj_cparse.c b/src/lj_cparse.c index 0c02c160..d9f66227 100644 --- a/src/lj_cparse.c +++ b/src/lj_cparse.c | |||
@@ -227,10 +227,10 @@ static CPToken cp_param(CPState *cp) | |||
227 | GCcdata *cd; | 227 | GCcdata *cd; |
228 | if (!tviscdata(o)) lj_err_argtype(cp->L, o-cp->L->base+1, "type parameter"); | 228 | if (!tviscdata(o)) lj_err_argtype(cp->L, o-cp->L->base+1, "type parameter"); |
229 | cd = cdataV(o); | 229 | cd = cdataV(o); |
230 | if (cd->typeid == CTID_CTYPEID) | 230 | if (cd->ctypeid == CTID_CTYPEID) |
231 | cp->val.id = *(CTypeID *)cdataptr(cd); | 231 | cp->val.id = *(CTypeID *)cdataptr(cd); |
232 | else | 232 | else |
233 | cp->val.id = cd->typeid; | 233 | cp->val.id = cd->ctypeid; |
234 | return '$'; | 234 | return '$'; |
235 | } | 235 | } |
236 | } | 236 | } |
@@ -970,16 +970,16 @@ static void cp_decl_reset(CPDecl *decl) | |||
970 | 970 | ||
971 | /* Parse constant initializer. */ | 971 | /* Parse constant initializer. */ |
972 | /* NYI: FP constants and strings as initializers. */ | 972 | /* NYI: FP constants and strings as initializers. */ |
973 | static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid) | 973 | static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID ctypeid) |
974 | { | 974 | { |
975 | CType *ctt = ctype_get(cp->cts, typeid); | 975 | CType *ctt = ctype_get(cp->cts, ctypeid); |
976 | CTInfo info; | 976 | CTInfo info; |
977 | CTSize size; | 977 | CTSize size; |
978 | CPValue k; | 978 | CPValue k; |
979 | CTypeID constid; | 979 | CTypeID constid; |
980 | while (ctype_isattrib(ctt->info)) { /* Skip attributes. */ | 980 | while (ctype_isattrib(ctt->info)) { /* Skip attributes. */ |
981 | typeid = ctype_cid(ctt->info); /* Update ID, too. */ | 981 | ctypeid = ctype_cid(ctt->info); /* Update ID, too. */ |
982 | ctt = ctype_get(cp->cts, typeid); | 982 | ctt = ctype_get(cp->cts, ctypeid); |
983 | } | 983 | } |
984 | info = ctt->info; | 984 | info = ctt->info; |
985 | size = ctt->size; | 985 | size = ctt->size; |
@@ -988,7 +988,7 @@ static CTypeID cp_decl_constinit(CPState *cp, CType **ctp, CTypeID typeid) | |||
988 | cp_check(cp, '='); | 988 | cp_check(cp, '='); |
989 | cp_expr_sub(cp, &k, 0); | 989 | cp_expr_sub(cp, &k, 0); |
990 | constid = lj_ctype_new(cp->cts, ctp); | 990 | constid = lj_ctype_new(cp->cts, ctp); |
991 | (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|typeid); | 991 | (*ctp)->info = CTINFO(CT_CONSTVAL, CTF_CONST|ctypeid); |
992 | k.u32 <<= 8*(4-size); | 992 | k.u32 <<= 8*(4-size); |
993 | if ((info & CTF_UNSIGNED)) | 993 | if ((info & CTF_UNSIGNED)) |
994 | k.u32 >>= 8*(4-size); | 994 | k.u32 >>= 8*(4-size); |
@@ -1352,18 +1352,18 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1352 | CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT|CPARSE_MODE_FIELD; | 1352 | CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT|CPARSE_MODE_FIELD; |
1353 | 1353 | ||
1354 | for (;;) { | 1354 | for (;;) { |
1355 | CTypeID typeid; | 1355 | CTypeID ctypeid; |
1356 | 1356 | ||
1357 | if (lastdecl) cp_err_token(cp, '}'); | 1357 | if (lastdecl) cp_err_token(cp, '}'); |
1358 | 1358 | ||
1359 | /* Parse field declarator. */ | 1359 | /* Parse field declarator. */ |
1360 | decl.bits = CTSIZE_INVALID; | 1360 | decl.bits = CTSIZE_INVALID; |
1361 | cp_declarator(cp, &decl); | 1361 | cp_declarator(cp, &decl); |
1362 | typeid = cp_decl_intern(cp, &decl); | 1362 | ctypeid = cp_decl_intern(cp, &decl); |
1363 | 1363 | ||
1364 | if ((scl & CDF_STATIC)) { /* Static constant in struct namespace. */ | 1364 | if ((scl & CDF_STATIC)) { /* Static constant in struct namespace. */ |
1365 | CType *ct; | 1365 | CType *ct; |
1366 | CTypeID fieldid = cp_decl_constinit(cp, &ct, typeid); | 1366 | CTypeID fieldid = cp_decl_constinit(cp, &ct, ctypeid); |
1367 | ctype_get(cp->cts, lastid)->sib = fieldid; | 1367 | ctype_get(cp->cts, lastid)->sib = fieldid; |
1368 | lastid = fieldid; | 1368 | lastid = fieldid; |
1369 | ctype_setname(ct, decl.name); | 1369 | ctype_setname(ct, decl.name); |
@@ -1371,7 +1371,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1371 | CTSize bsz = CTBSZ_FIELD; /* Temp. for layout phase. */ | 1371 | CTSize bsz = CTBSZ_FIELD; /* Temp. for layout phase. */ |
1372 | CType *ct; | 1372 | CType *ct; |
1373 | CTypeID fieldid = lj_ctype_new(cp->cts, &ct); /* Do this first. */ | 1373 | CTypeID fieldid = lj_ctype_new(cp->cts, &ct); /* Do this first. */ |
1374 | CType *tct = ctype_raw(cp->cts, typeid); | 1374 | CType *tct = ctype_raw(cp->cts, ctypeid); |
1375 | 1375 | ||
1376 | if (decl.bits == CTSIZE_INVALID) { /* Regular field. */ | 1376 | if (decl.bits == CTSIZE_INVALID) { /* Regular field. */ |
1377 | if (ctype_isarray(tct->info) && tct->size == CTSIZE_INVALID) | 1377 | if (ctype_isarray(tct->info) && tct->size == CTSIZE_INVALID) |
@@ -1382,7 +1382,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1382 | if (!((ctype_isstruct(tct->info) && !(tct->info & CTF_VLA)) || | 1382 | if (!((ctype_isstruct(tct->info) && !(tct->info & CTF_VLA)) || |
1383 | ctype_isenum(tct->info))) | 1383 | ctype_isenum(tct->info))) |
1384 | cp_err_token(cp, CTOK_IDENT); | 1384 | cp_err_token(cp, CTOK_IDENT); |
1385 | ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + typeid); | 1385 | ct->info = CTINFO(CT_ATTRIB, CTATTRIB(CTA_SUBTYPE) + ctypeid); |
1386 | ct->size = ctype_isstruct(tct->info) ? | 1386 | ct->size = ctype_isstruct(tct->info) ? |
1387 | (decl.attr|0x80000000u) : 0; /* For layout phase. */ | 1387 | (decl.attr|0x80000000u) : 0; /* For layout phase. */ |
1388 | goto add_field; | 1388 | goto add_field; |
@@ -1396,7 +1396,7 @@ static CTypeID cp_decl_struct(CPState *cp, CPDecl *sdecl, CTInfo sinfo) | |||
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | /* Create temporary field for layout phase. */ | 1398 | /* Create temporary field for layout phase. */ |
1399 | ct->info = CTINFO(CT_FIELD, typeid + (bsz << CTSHIFT_BITCSZ)); | 1399 | ct->info = CTINFO(CT_FIELD, ctypeid + (bsz << CTSHIFT_BITCSZ)); |
1400 | ct->size = decl.attr; | 1400 | ct->size = decl.attr; |
1401 | if (decl.name) ctype_setname(ct, decl.name); | 1401 | if (decl.name) ctype_setname(ct, decl.name); |
1402 | 1402 | ||
@@ -1601,7 +1601,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1601 | if (cp->tok != ')') { | 1601 | if (cp->tok != ')') { |
1602 | do { | 1602 | do { |
1603 | CPDecl decl; | 1603 | CPDecl decl; |
1604 | CTypeID typeid, fieldid; | 1604 | CTypeID ctypeid, fieldid; |
1605 | CType *ct; | 1605 | CType *ct; |
1606 | if (cp_opt(cp, '.')) { /* Vararg function. */ | 1606 | if (cp_opt(cp, '.')) { /* Vararg function. */ |
1607 | cp_check(cp, '.'); /* Workaround for the minimalistic lexer. */ | 1607 | cp_check(cp, '.'); /* Workaround for the minimalistic lexer. */ |
@@ -1612,16 +1612,16 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1612 | cp_decl_spec(cp, &decl, CDF_REGISTER); | 1612 | cp_decl_spec(cp, &decl, CDF_REGISTER); |
1613 | decl.mode = CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT; | 1613 | decl.mode = CPARSE_MODE_DIRECT|CPARSE_MODE_ABSTRACT; |
1614 | cp_declarator(cp, &decl); | 1614 | cp_declarator(cp, &decl); |
1615 | typeid = cp_decl_intern(cp, &decl); | 1615 | ctypeid = cp_decl_intern(cp, &decl); |
1616 | ct = ctype_raw(cp->cts, typeid); | 1616 | ct = ctype_raw(cp->cts, ctypeid); |
1617 | if (ctype_isvoid(ct->info)) | 1617 | if (ctype_isvoid(ct->info)) |
1618 | break; | 1618 | break; |
1619 | else if (ctype_isrefarray(ct->info)) | 1619 | else if (ctype_isrefarray(ct->info)) |
1620 | typeid = lj_ctype_intern(cp->cts, | 1620 | ctypeid = lj_ctype_intern(cp->cts, |
1621 | CTINFO(CT_PTR, CTALIGN_PTR|ctype_cid(ct->info)), CTSIZE_PTR); | 1621 | CTINFO(CT_PTR, CTALIGN_PTR|ctype_cid(ct->info)), CTSIZE_PTR); |
1622 | else if (ctype_isfunc(ct->info)) | 1622 | else if (ctype_isfunc(ct->info)) |
1623 | typeid = lj_ctype_intern(cp->cts, | 1623 | ctypeid = lj_ctype_intern(cp->cts, |
1624 | CTINFO(CT_PTR, CTALIGN_PTR|typeid), CTSIZE_PTR); | 1624 | CTINFO(CT_PTR, CTALIGN_PTR|ctypeid), CTSIZE_PTR); |
1625 | /* Add new parameter. */ | 1625 | /* Add new parameter. */ |
1626 | fieldid = lj_ctype_new(cp->cts, &ct); | 1626 | fieldid = lj_ctype_new(cp->cts, &ct); |
1627 | if (anchor) | 1627 | if (anchor) |
@@ -1630,7 +1630,7 @@ static void cp_decl_func(CPState *cp, CPDecl *fdecl) | |||
1630 | anchor = fieldid; | 1630 | anchor = fieldid; |
1631 | lastid = fieldid; | 1631 | lastid = fieldid; |
1632 | if (decl.name) ctype_setname(ct, decl.name); | 1632 | if (decl.name) ctype_setname(ct, decl.name); |
1633 | ct->info = CTINFO(CT_FIELD, typeid); | 1633 | ct->info = CTINFO(CT_FIELD, ctypeid); |
1634 | ct->size = nargs++; | 1634 | ct->size = nargs++; |
1635 | } while (cp_opt(cp, ',')); | 1635 | } while (cp_opt(cp, ',')); |
1636 | } | 1636 | } |
@@ -1794,28 +1794,28 @@ static void cp_decl_multi(CPState *cp) | |||
1794 | goto decl_end; /* Accept empty declaration of struct/union/enum. */ | 1794 | goto decl_end; /* Accept empty declaration of struct/union/enum. */ |
1795 | } | 1795 | } |
1796 | for (;;) { | 1796 | for (;;) { |
1797 | CTypeID typeid; | 1797 | CTypeID ctypeid; |
1798 | cp_declarator(cp, &decl); | 1798 | cp_declarator(cp, &decl); |
1799 | typeid = cp_decl_intern(cp, &decl); | 1799 | ctypeid = cp_decl_intern(cp, &decl); |
1800 | if (decl.name && !decl.nameid) { /* NYI: redeclarations are ignored. */ | 1800 | if (decl.name && !decl.nameid) { /* NYI: redeclarations are ignored. */ |
1801 | CType *ct; | 1801 | CType *ct; |
1802 | CTypeID id; | 1802 | CTypeID id; |
1803 | if ((scl & CDF_TYPEDEF)) { /* Create new typedef. */ | 1803 | if ((scl & CDF_TYPEDEF)) { /* Create new typedef. */ |
1804 | id = lj_ctype_new(cp->cts, &ct); | 1804 | id = lj_ctype_new(cp->cts, &ct); |
1805 | ct->info = CTINFO(CT_TYPEDEF, typeid); | 1805 | ct->info = CTINFO(CT_TYPEDEF, ctypeid); |
1806 | goto noredir; | 1806 | goto noredir; |
1807 | } else if (ctype_isfunc(ctype_get(cp->cts, typeid)->info)) { | 1807 | } else if (ctype_isfunc(ctype_get(cp->cts, ctypeid)->info)) { |
1808 | /* Treat both static and extern function declarations as extern. */ | 1808 | /* Treat both static and extern function declarations as extern. */ |
1809 | ct = ctype_get(cp->cts, typeid); | 1809 | ct = ctype_get(cp->cts, ctypeid); |
1810 | /* We always get new anonymous functions (typedefs are copied). */ | 1810 | /* We always get new anonymous functions (typedefs are copied). */ |
1811 | lua_assert(gcref(ct->name) == NULL); | 1811 | lua_assert(gcref(ct->name) == NULL); |
1812 | id = typeid; /* Just name it. */ | 1812 | id = ctypeid; /* Just name it. */ |
1813 | } else if ((scl & CDF_STATIC)) { /* Accept static constants. */ | 1813 | } else if ((scl & CDF_STATIC)) { /* Accept static constants. */ |
1814 | id = cp_decl_constinit(cp, &ct, typeid); | 1814 | id = cp_decl_constinit(cp, &ct, ctypeid); |
1815 | goto noredir; | 1815 | goto noredir; |
1816 | } else { /* External references have extern or no storage class. */ | 1816 | } else { /* External references have extern or no storage class. */ |
1817 | id = lj_ctype_new(cp->cts, &ct); | 1817 | id = lj_ctype_new(cp->cts, &ct); |
1818 | ct->info = CTINFO(CT_EXTERN, typeid); | 1818 | ct->info = CTINFO(CT_EXTERN, ctypeid); |
1819 | } | 1819 | } |
1820 | if (decl.redir) { /* Add attribute for redirected symbol name. */ | 1820 | if (decl.redir) { /* Add attribute for redirected symbol name. */ |
1821 | CType *cta; | 1821 | CType *cta; |