630, 638, 640, 644, 647, 648, 651, 654, 660, 664,
665, 668, 671, 672, 675, 676, 677, 680, 681, 682,
683, 684, 687, 688, 689, 690, 691, 694, 695, 698,
- 704, 708, 710, 714, 715, 717, 724, 734, 735, 738,
- 739, 740, 741, 742, 743, 744, 745, 749, 750, 754,
- 755, 758, 760, 762, 763, 764, 765, 766, 768, 772,
- 773, 776, 780, 792, 793, 794, 795, 796, 797, 798,
- 799, 803, 804, 805, 806, 807, 808, 809, 810, 811,
- 812, 816, 817, 820, 821, 822, 823, 824, 825, 826,
- 827, 828, 829, 830, 833, 834, 837, 841, 842, 845,
- 846, 847, 848, 851, 852, 856, 857, 858, 859, 862,
- 863, 864, 867, 868, 869, 872, 873, 874, 875, 876,
- 879, 880, 881, 884, 885, 888, 889, 893, 894, 897,
- 898, 903, 909, 910, 916, 922, 923, 923, 925, 928,
- 929, 930, 931, 932, 933, 934, 935, 936, 937, 938,
- 939, 942, 943, 946, 947, 950, 955, 956, 957, 960,
- 974, 979, 985, 987, 993, 998, 998, 1002, 1003, 1005,
- 1006, 1009, 1012, 1015, 1018, 1019, 1022, 1023, 1026, 1027,
- 1028, 1029, 1036, 1037, 1041, 1042, 1045, 1046, 1049, 1051,
- 1060, 1061, 1062, 1063, 1064, 1067, 1070, 1076, 1085, 1088,
- 1091, 1098, 1105, 1111, 1136, 1137, 1140, 1141, 1142, 1143,
- 1144, 1147, 1148, 1149, 1150, 1153, 1154, 1155, 1156, 1157,
- 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167,
- 1168, 1169, 1173, 1174, 1177, 1178, 1181, 1182, 1185, 1186,
- 1187, 1188, 1191, 1192, 1193, 1194, 1195, 1196, 1199, 1200,
- 1201, 1202, 1205, 1206, 1207, 1208, 1211, 1212, 1213, 1214,
- 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1228, 1229, 1230,
- 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240,
- 1241, 1244, 1248, 1249, 1253, 1254, 1258, 1259, 1260, 1263,
- 1264, 1268, 1275, 1277, 1279, 1281, 1283, 1285, 1286, 1288,
- 1290, 1292, 1294, 1295, 1296, 1299, 1300, 1302, 1304, 1305,
- 1308, 1311, 1312, 1313, 1316, 1318, 1322, 1324, 1328, 1329,
- 1330, 1334, 1336, 1336, 1338, 1341, 1343, 1345, 1348, 1353,
- 1360, 1361, 1362, 1369, 1373, 1374, 1378, 1379, 1382, 1383,
- 1386, 1387, 1390, 1391, 1392, 1393, 1396, 1397, 1400, 1401,
- 1404, 1405, 1406, 1409, 1409, 1410, 1411, 1414, 1426, 1442,
- 1443, 1446, 1447, 1448, 1451, 1452, 1455, 1457, 1458, 1460,
- 1461, 1463, 1465, 1467, 1469, 1475, 1476, 1477, 1478, 1479,
- 1480, 1481, 1482, 1483, 1487, 1490, 1493, 1494, 1498, 1500,
- 1502, 1504, 1508, 1509, 1511, 1515, 1517, 1519, 1522, 1523,
- 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533,
- 1534, 1537, 1538, 1543, 1546, 1549, 1550, 1553, 1554, 1555,
- 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1566, 1567,
- 1574, 1575, 1581, 1582, 1583, 1584, 1587, 1588, 1589, 1590,
- 1593, 1594, 1598, 1601, 1604, 1607, 1610, 1613, 1616, 1617,
- 1618, 1619, 1621, 1622, 1624, 1626, 1632, 1636, 1638, 1640,
- 1642, 1646, 1647, 1650, 1651, 1654, 1655, 1658, 1659, 1662,
- 1663, 1666, 1667, 1670, 1671, 1672, 1675, 1688, 1693, 1694,
- 1698, 1699, 1702, 1707, 1710, 1711, 1712, 1720, 1721, 1721,
- 1725, 1726, 1727, 1738, 1745, 1746, 1749, 1750, 1753, 1754,
- 1755, 1756, 1757, 1759, 1760, 1761, 1762, 1765, 1766, 1767,
- 1768, 1769, 1770, 1771, 1772, 1773, 1774, 1777, 1778, 1781,
- 1782, 1783, 1784, 1787, 1788, 1789, 1792, 1793, 1794, 1797,
- 1798, 1799, 1800, 1801, 1804, 1805, 1806, 1809, 1810, 1813,
- 1814, 1818, 1819, 1822, 1823, 1826, 1827, 1830, 1831, 1832,
- 1833, 1836, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844,
- 1845, 1846, 1847, 1850, 1851, 1854, 1857, 1859, 1861, 1865,
- 1866, 1868, 1870, 1873, 1874, 1875, 1877, 1878, 1879, 1880,
- 1881, 1882, 1883, 1886, 1887, 1890, 1891, 1894, 1897, 1898,
- 1899, 1900, 1901, 1904, 1905, 1906, 1907
+ 705, 709, 711, 715, 716, 718, 725, 735, 736, 739,
+ 740, 741, 742, 743, 744, 745, 746, 750, 751, 755,
+ 756, 759, 761, 763, 764, 765, 766, 767, 769, 773,
+ 774, 777, 781, 793, 794, 795, 796, 797, 798, 799,
+ 800, 804, 805, 806, 807, 808, 809, 810, 811, 812,
+ 813, 817, 818, 821, 822, 823, 824, 825, 826, 827,
+ 828, 829, 830, 831, 834, 835, 838, 842, 843, 846,
+ 847, 848, 849, 852, 853, 857, 858, 859, 860, 863,
+ 864, 865, 868, 869, 870, 873, 874, 875, 876, 877,
+ 880, 881, 882, 885, 886, 889, 890, 894, 895, 898,
+ 899, 904, 910, 911, 917, 923, 924, 924, 926, 929,
+ 930, 931, 932, 933, 934, 935, 936, 937, 938, 939,
+ 940, 943, 944, 947, 948, 951, 956, 957, 958, 961,
+ 975, 980, 986, 988, 994, 999, 999, 1003, 1004, 1006,
+ 1007, 1010, 1013, 1016, 1019, 1020, 1023, 1024, 1027, 1028,
+ 1029, 1030, 1037, 1038, 1042, 1043, 1046, 1047, 1050, 1052,
+ 1061, 1062, 1063, 1064, 1065, 1068, 1071, 1077, 1086, 1089,
+ 1092, 1099, 1106, 1112, 1137, 1138, 1141, 1142, 1143, 1144,
+ 1145, 1148, 1149, 1150, 1151, 1154, 1155, 1156, 1157, 1158,
+ 1159, 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168,
+ 1169, 1170, 1174, 1175, 1178, 1179, 1182, 1183, 1186, 1187,
+ 1188, 1189, 1192, 1193, 1194, 1195, 1196, 1197, 1200, 1201,
+ 1202, 1203, 1206, 1207, 1208, 1209, 1212, 1213, 1214, 1215,
+ 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1229, 1230, 1231,
+ 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241,
+ 1242, 1245, 1249, 1250, 1254, 1255, 1259, 1260, 1261, 1264,
+ 1265, 1269, 1276, 1278, 1280, 1282, 1284, 1286, 1287, 1289,
+ 1291, 1293, 1295, 1296, 1297, 1300, 1301, 1303, 1305, 1306,
+ 1309, 1312, 1313, 1314, 1317, 1319, 1323, 1325, 1329, 1330,
+ 1331, 1335, 1337, 1337, 1339, 1342, 1344, 1346, 1349, 1354,
+ 1361, 1362, 1363, 1370, 1374, 1375, 1379, 1380, 1383, 1384,
+ 1387, 1388, 1391, 1392, 1393, 1394, 1397, 1398, 1401, 1402,
+ 1405, 1406, 1407, 1410, 1410, 1411, 1412, 1415, 1427, 1443,
+ 1444, 1447, 1448, 1449, 1452, 1453, 1456, 1458, 1459, 1461,
+ 1462, 1464, 1466, 1468, 1470, 1476, 1477, 1478, 1479, 1480,
+ 1481, 1482, 1483, 1484, 1488, 1491, 1494, 1495, 1499, 1501,
+ 1503, 1505, 1509, 1510, 1512, 1516, 1518, 1520, 1523, 1524,
+ 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, 1533, 1534,
+ 1535, 1538, 1539, 1544, 1547, 1550, 1551, 1554, 1555, 1556,
+ 1557, 1558, 1559, 1560, 1561, 1562, 1563, 1564, 1567, 1568,
+ 1575, 1576, 1582, 1583, 1584, 1585, 1588, 1589, 1590, 1591,
+ 1594, 1595, 1599, 1602, 1605, 1608, 1611, 1614, 1617, 1618,
+ 1619, 1620, 1622, 1623, 1625, 1627, 1633, 1637, 1639, 1641,
+ 1643, 1647, 1648, 1651, 1652, 1655, 1656, 1659, 1660, 1663,
+ 1664, 1667, 1668, 1671, 1672, 1673, 1676, 1689, 1694, 1695,
+ 1699, 1700, 1703, 1708, 1711, 1712, 1713, 1721, 1722, 1722,
+ 1726, 1727, 1728, 1739, 1746, 1747, 1750, 1751, 1754, 1755,
+ 1756, 1757, 1758, 1760, 1761, 1762, 1763, 1766, 1767, 1768,
+ 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1778, 1779, 1782,
+ 1783, 1784, 1785, 1788, 1789, 1790, 1793, 1794, 1795, 1798,
+ 1799, 1800, 1801, 1802, 1805, 1806, 1807, 1810, 1811, 1814,
+ 1815, 1819, 1820, 1823, 1824, 1827, 1828, 1831, 1832, 1833,
+ 1834, 1837, 1838, 1839, 1840, 1841, 1842, 1843, 1844, 1845,
+ 1846, 1847, 1848, 1851, 1852, 1855, 1858, 1860, 1862, 1866,
+ 1867, 1869, 1871, 1874, 1875, 1876, 1878, 1879, 1880, 1881,
+ 1882, 1883, 1884, 1887, 1888, 1891, 1892, 1895, 1898, 1899,
+ 1900, 1901, 1902, 1905, 1906, 1907, 1908
};
#endif
break;}
case 130:
{
- qtype qint = qtype_create (ctype_int);
+ /**!!! deal with fred; fred (int); declarations! **/
+ qtype qint = qtype_create (ctype_int);
yyval.ntyp = idDecl_fixBase (yyvsp[0].ntyp, qint);
qtype_free (qint);
;
static void clabstract_prepareFunction (uentry p_e) /*@modifies p_e@*/ ;
static bool fcnNoGlobals = FALSE;
-static bool ProcessingVars = FALSE;
-static bool ProcessingParams = FALSE;
-static bool ProcessingGlobals = FALSE;
-static bool ProcessingTypedef = FALSE;
-static bool ProcessingIterVars = FALSE;
+static void processVariable (/*@temp@*/ idDecl p_t) /*@modifies internalState@*/ ;
+
+static bool s_processingVars = FALSE;
+static bool s_processingParams = FALSE;
+static bool s_processingGlobals = FALSE;
+static bool s_processingTypedef = FALSE;
+static bool s_processingIterVars = FALSE;
static /*@only@*/ qtype processingType = qtype_undefined;
static uentry currentIter = uentry_undefined;
static /*@dependent@*/ uentryList saveParamList; /* for old style functions */
extern void nextIterParam (void)
{
- llassert (ProcessingIterVars);
+ llassert (s_processingIterVars);
saveIterParamNo++;
}
extern int iterParamNo (void)
{
- llassert (ProcessingIterVars);
+ llassert (s_processingIterVars);
return saveIterParamNo;
}
ue = uentry_makeIdFunction (tid);
reflectSpecialCode (ue);
reflectArgsUsed (ue);
+ reflectStorageClass (ue);
+ uentry_checkParams (ue);
+
+ DPRINTF (("Supercede function: %s", uentry_unparseFull (ue)));
+
+ ue = usymtab_supGlobalEntryReturn (ue);
+ DPRINTF (("After supercede function: %s", uentry_unparseFull (ue)));
+
+ DPRINTF (("Enter function: %s", uentry_unparseFull (ue)));
+ context_enterFunction (ue);
+ enterFunctionParams (uentry_getParams (ue));
+
+ resetStorageClass ();
+ DPRINTF (("Function: %s", uentry_unparseFull (ue)));
+ return (ue);
}
else
{
- llparseerror (message ("Inconsistent function declaration: %q",
+ llparseerror (message ("Non-function declaration: %q",
idDecl_unparse (tid)));
-
- tid = idDecl_replaceCtype
- (tid, ctype_makeFunction (ctype_unknown, uentryList_undefined));
- ue = uentry_makeIdFunction (tid);
+ return (uentry_undefined);
}
-
- reflectStorageClass (ue);
- uentry_checkParams (ue);
-
- DPRINTF (("Supercede function: %s", uentry_unparseFull (ue)));
-
- ue = usymtab_supGlobalEntryReturn (ue);
- DPRINTF (("After supercede function: %s", uentry_unparseFull (ue)));
-
- DPRINTF (("Enter function: %s", uentry_unparseFull (ue)));
- context_enterFunction (ue);
- enterFunctionParams (uentry_getParams (ue));
-
- resetStorageClass ();
- DPRINTF (("Function: %s", uentry_unparseFull (ue)));
- return (ue);
}
/*
DPRINTF (("Declare function: %s", idDecl_unparse (tid)));
- if (ProcessingParams)
+ if (ctype_isUnknown (idDecl_getCtype (tid)))
{
- ue = globalDeclareOldStyleFunction (tid);
- saveFunction = ue;
- DPRINTF (("Set save function: %s", uentry_unparseFull (ue)));
+ /*
+ ** No type, its really a plain name (int) declaration
+ */
+
+ voptgenerror (FLG_IMPTYPE,
+ message ("No type before declaration name (implicit int type): %q",
+ idDecl_unparse (tid)),
+ g_currentloc);
+ tid = idDecl_replaceCtype (tid, ctype_int);
+ processVariable (tid);
+ saveFunction = uentry_undefined;
}
else
{
- saveFunction = uentry_undefined;
-
- if (context_inRealFunction ())
+ if (s_processingParams)
{
- ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown);
-
- llparseerror (message ("Function declared inside function: %q",
- idDecl_unparse (tid)));
-
- context_quietExitFunction ();
- ue = usymtab_supEntryReturn (ue);
+ ue = globalDeclareOldStyleFunction (tid);
+ saveFunction = ue;
+ DPRINTF (("Set save function: %s", uentry_unparseFull (ue)));
}
else
{
- if (context_inInnerScope ())
+ saveFunction = uentry_undefined;
+
+ if (context_inRealFunction ())
{
- llparseerror (message ("Declaration in inner context: %q",
+ ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown);
+
+ llparseerror (message ("Function declared inside function: %q",
idDecl_unparse (tid)));
- sRef_setGlobalScope ();
- ue = uentry_makeVariableLoc (idDecl_observeId (tid),
- ctype_unknown);
- ue = usymtab_supGlobalEntryReturn (ue);
- sRef_clearGlobalScope ();
+ context_quietExitFunction ();
+ ue = usymtab_supEntryReturn (ue);
}
else
{
- ue = clabstract_globalDeclareFunction (tid);
+ if (context_inInnerScope ())
+ {
+ llparseerror (message ("Declaration in inner context: %q",
+ idDecl_unparse (tid)));
+
+ sRef_setGlobalScope ();
+ ue = uentry_makeVariableLoc (idDecl_observeId (tid),
+ ctype_unknown);
+ ue = usymtab_supGlobalEntryReturn (ue);
+ sRef_clearGlobalScope ();
+ }
+ else
+ {
+ ue = clabstract_globalDeclareFunction (tid);
+ }
}
+
+ resetGlobals ();
}
- resetGlobals ();
+ resetStorageClass ();
+ idDecl_free (tid);
}
-
- resetStorageClass ();
- idDecl_free (tid);
}
void declareStaticFunction (idDecl tid) /*@globals undef saveFunction; @*/
DPRINTF (("Declare static funciton: %s", idDecl_unparse (tid)));
- if (ProcessingParams)
+ if (s_processingParams)
{
ue = globalDeclareOldStyleFunction (tid);
saveFunction = ue;
}
else
{
+ DPRINTF (("Here we are!"));
llparseerror (message ("Inconsistent function declaration: %q",
idDecl_unparse (tid)));
void
setProcessingIterVars (uentry iter)
{
- ProcessingIterVars = TRUE;
+ s_processingIterVars = TRUE;
currentIter = iter;
saveIterParamNo = 0;
}
void
setProcessingGlobalsList ()
{
- ProcessingGlobals = TRUE;
+ s_processingGlobals = TRUE;
fcnNoGlobals = FALSE;
}
static void resetGlobals (void)
{
- ProcessingGlobals = FALSE;
+ s_processingGlobals = FALSE;
fcnNoGlobals = FALSE;
}
void
unsetProcessingGlobals ()
{
- ProcessingGlobals = FALSE;
+ s_processingGlobals = FALSE;
}
void
setProcessingVars (/*@only@*/ qtype q)
{
- ProcessingVars = TRUE;
+ s_processingVars = TRUE;
qtype_free (processingType);
processingType = q;
}
static void
setGenericParamList (/*@dependent@*/ uentryList pm)
{
- ProcessingParams = TRUE;
+ s_processingParams = TRUE;
saveParamList = pm;
}
void
setProcessingTypedef (qtype q)
{
- ProcessingTypedef = TRUE;
+ s_processingTypedef = TRUE;
qtype_free (processingType);
processingType = q;
unsetProcessingVars ()
{
resetStorageClass ();
- ProcessingVars = FALSE;
+ s_processingVars = FALSE;
}
void
oldStyleDoneParams ()
{
- if (ProcessingParams)
+ if (s_processingParams)
{
if (uentry_isInvalid (saveFunction))
{
ctype ct2 = ctype_makeFunction (ct, params);
uentry_setType (saveFunction, ct2);
- ProcessingParams = FALSE;
+ s_processingParams = FALSE;
oldStyleCompleteFunction (saveFunction);
saveFunction = uentry_undefined;
ct2 = ctype_makeParamsFunction (ct, uentryList_copy (saveParamList));
uentry_setType (saveFunction, ct2);
- ProcessingParams = FALSE;
+ s_processingParams = FALSE;
oldStyleDeclareFunction (saveFunction);
saveFunction = uentry_undefined;
void clabstract_declareType (/*@only@*/ exprNodeList decls, /*@only@*/ warnClause warn)
{
- llassert (ProcessingTypedef);
+ llassert (s_processingTypedef);
DPRINTF (("Declare type: %s", exprNodeList_unparse (decls)));
void
unsetProcessingTypedef ()
{
- ProcessingTypedef = FALSE;
+ s_processingTypedef = FALSE;
}
void checkConstant (qtype t, idDecl id)
usymtab_supGlobalEntry (ue);
}
-void processNamedDecl (idDecl t)
+static void processVariable (idDecl t)
{
- if (qtype_isUndefined (processingType))
- {
- llparseerror (message ("No type before declaration name: %q", idDecl_unparse (t)));
-
- processingType = qtype_create (ctype_unknown);
- }
-
- t = idDecl_fixBase (t, processingType);
-
- DPRINTF (("Declare: %s", idDecl_unparse (t)));
+ uentry e;
+ ctype ct;
- if (ProcessingGlobals)
+ ct = ctype_realType (idDecl_getCtype (t));
+
+ if (s_processingParams)
{
cstring id = idDecl_getName (t);
- uentry ue = usymtab_lookupSafe (id);
+ int paramno = uentryList_lookupRealName (saveParamList, id);
- if (!uentry_isValid (ue))
+ if (paramno >= 0)
{
- llerror (FLG_UNRECOG,
- message ("Variable used in globals list is undeclared: %s", id));
+ uentry cparam = uentryList_getN (saveParamList, paramno);
+
+ DPRINTF (("Processing param: %s", uentry_unparseFull (cparam)));
+ uentry_setType (cparam, idDecl_getCtype (t));
+ uentry_reflectQualifiers (cparam, idDecl_getQuals (t));
+ uentry_setDeclaredOnly (cparam, context_getSaveLocation ());
+ DPRINTF (("Processing param: %s", uentry_unparseFull (cparam)));
}
else
{
- if (!ctype_match (uentry_getType (ue), idDecl_getCtype (t)))
- {
- voptgenerror
- (FLG_INCONDEFS,
- message ("Variable %s used in globals list declared %s, "
- "but listed as %s",
- id, ctype_unparse (uentry_getType (ue)),
- ctype_unparse (idDecl_getCtype (t))),
- g_currentloc);
- }
- else
- {
- sRef sr = sRef_copy (uentry_getSref (ue));
- reflectGlobalQualifiers (sr, idDecl_getQuals (t));
- }
+ llfatalerrorLoc
+ (message ("Old style declaration uses unlisted parameter: %s",
+ id));
}
}
- else if (ProcessingVars)
+ else
{
- uentry e;
- ctype ct;
+ fileloc loc;
- ct = ctype_realType (idDecl_getCtype (t));
-
- if (ProcessingParams)
+ if (context_inIterDef ())
{
- cstring id = idDecl_getName (t);
- int paramno = uentryList_lookupRealName (saveParamList, id);
-
- if (paramno >= 0)
- {
- uentry cparam = uentryList_getN (saveParamList, paramno);
-
- DPRINTF (("Processing param: %s", uentry_unparseFull (cparam)));
- uentry_setType (cparam, idDecl_getCtype (t));
- uentry_reflectQualifiers (cparam, idDecl_getQuals (t));
- uentry_setDeclaredOnly (cparam, context_getSaveLocation ());
- DPRINTF (("Processing param: %s", uentry_unparseFull (cparam)));
- }
- else
+ cstring pname = makeParam (idDecl_observeId (t));
+ uentry p = usymtab_lookupSafe (pname);
+
+ cstring_free (pname);
+
+ if (uentry_isYield (p))
{
- llfatalerrorLoc
- (message ("Old style declaration uses unlisted parameter: %s",
- id));
+ e = uentry_makeParam (t, sRef_getParam (uentry_getSref (p)));
+ uentry_checkYieldParam (p, e);
+ usymtab_supEntrySref (e);
+ return;
}
}
+
+ if ((hasSpecialCode () || argsUsed)
+ && ctype_isFunction (idDecl_getCtype (t)))
+ {
+ e = uentry_makeIdFunction (t);
+ reflectSpecialCode (e);
+ reflectArgsUsed (e);
+ }
else
{
- fileloc loc;
-
- if (context_inIterDef ())
- {
- cstring pname = makeParam (idDecl_observeId (t));
- uentry p = usymtab_lookupSafe (pname);
-
- cstring_free (pname);
-
- if (uentry_isYield (p))
- {
- e = uentry_makeParam (t, sRef_getParam (uentry_getSref (p)));
- uentry_checkYieldParam (p, e);
- usymtab_supEntrySref (e);
- return;
- }
- }
-
- if ((hasSpecialCode () || argsUsed)
- && ctype_isFunction (idDecl_getCtype (t)))
- {
- e = uentry_makeIdFunction (t);
- reflectSpecialCode (e);
- reflectArgsUsed (e);
- }
- else
- {
- e = uentry_makeIdVariable (t);
- }
-
- loc = uentry_whereDeclared (e);
-
- /*
- if (context_inGlobalScope ())
- {
- uentry_checkParams was here!
- }
- */
+ e = uentry_makeIdVariable (t);
+ }
+
+ loc = uentry_whereDeclared (e);
+
+ /*
+ if (context_inGlobalScope ())
+ {
+ uentry_checkParams was here!
+ }
+ */
+
+ if (ctype_isFunction (uentry_getType (e)))
+ {
+ clabstract_prepareFunction (e);
+ }
+
+ DPRINTF (("Superceding... %s", uentry_unparseFull (e)));
+ e = usymtab_supEntrySrefReturn (e);
+ DPRINTF (("After superceding... %s", uentry_unparseFull (e)));
+
+ if (uentry_isExtern (e) && !context_inGlobalScope ())
+ {
+ voptgenerror
+ (FLG_NESTEDEXTERN,
+ message ("Declaration using extern inside function scope: %q",
+ uentry_unparse (e)),
+ g_currentloc);
- if (ctype_isFunction (uentry_getType (e)))
+ uentry_setDefined (e, fileloc_getExternal ());
+ sRef_setDefined (uentry_getSref (e), fileloc_getExternal ());
+ }
+
+ if (uentry_isFunction (e))
+ {
+ if (!context_inXHFile ())
{
- clabstract_prepareFunction (e);
+ checkParamNames (e);
}
+ }
+
+ if (uentry_isVar (e) && uentry_isCheckedUnknown (e))
+ {
+ sRef sr = uentry_getSref (e);
- DPRINTF (("Superceding... %s", uentry_unparseFull (e)));
- e = usymtab_supEntrySrefReturn (e);
- DPRINTF (("After superceding... %s", uentry_unparseFull (e)));
-
- if (uentry_isExtern (e) && !context_inGlobalScope ())
+ if (sRef_isLocalVar (sr))
{
- voptgenerror
- (FLG_NESTEDEXTERN,
- message ("Declaration using extern inside function scope: %q",
- uentry_unparse (e)),
- g_currentloc);
-
- uentry_setDefined (e, fileloc_getExternal ());
- sRef_setDefined (uentry_getSref (e), fileloc_getExternal ());
+ if (context_getFlag (FLG_IMPCHECKMODINTERNALS))
+ {
+ uentry_setCheckMod (e);
+ }
+ else
+ {
+ uentry_setUnchecked (e);
+ }
}
-
- if (uentry_isFunction (e))
+ else if (sRef_isFileStatic (sr))
{
- if (!context_inXHFile ())
+ if (context_getFlag (FLG_IMPCHECKEDSTRICTSTATICS))
+ {
+ uentry_setCheckedStrict (e);
+ }
+ else if (context_getFlag (FLG_IMPCHECKEDSTATICS))
{
- checkParamNames (e);
+ uentry_setChecked (e);
+ }
+ else if (context_getFlag (FLG_IMPCHECKMODSTATICS))
+ {
+ uentry_setCheckMod (e);
+ }
+ else
+ {
+ ;
}
}
-
- if (uentry_isVar (e) && uentry_isCheckedUnknown (e))
+ else /* real global */
{
- sRef sr = uentry_getSref (e);
+ llassert (sRef_isRealGlobal (sr));
- if (sRef_isLocalVar (sr))
+ if (context_getFlag (FLG_IMPCHECKEDSTRICTGLOBALS))
{
- if (context_getFlag (FLG_IMPCHECKMODINTERNALS))
- {
- uentry_setCheckMod (e);
- }
- else
- {
- uentry_setUnchecked (e);
- }
+ uentry_setCheckedStrict (e);
}
- else if (sRef_isFileStatic (sr))
+ else if (context_getFlag (FLG_IMPCHECKEDGLOBALS))
{
- if (context_getFlag (FLG_IMPCHECKEDSTRICTSTATICS))
- {
- uentry_setCheckedStrict (e);
- }
- else if (context_getFlag (FLG_IMPCHECKEDSTATICS))
- {
- uentry_setChecked (e);
- }
- else if (context_getFlag (FLG_IMPCHECKMODSTATICS))
- {
- uentry_setCheckMod (e);
- }
- else
- {
- ;
- }
+ uentry_setChecked (e);
}
- else /* real global */
+ else if (context_getFlag (FLG_IMPCHECKMODGLOBALS))
{
- llassert (sRef_isRealGlobal (sr));
-
- if (context_getFlag (FLG_IMPCHECKEDSTRICTGLOBALS))
- {
- uentry_setCheckedStrict (e);
- }
- else if (context_getFlag (FLG_IMPCHECKEDGLOBALS))
- {
- uentry_setChecked (e);
- }
- else if (context_getFlag (FLG_IMPCHECKMODGLOBALS))
- {
- uentry_setCheckMod (e);
- }
- else
- {
- ;
- }
+ uentry_setCheckMod (e);
+ }
+ else
+ {
+ ;
}
}
}
}
- else if (ProcessingTypedef)
+}
+
+void processNamedDecl (idDecl t)
+{
+ if (qtype_isUndefined (processingType))
+ {
+ processingType = qtype_create (ctype_int);
+ t = idDecl_fixBase (t, processingType);
+
+ voptgenerror (FLG_IMPTYPE,
+ message ("No type before declaration name (implicit int type): %q",
+ idDecl_unparse (t)),
+ g_currentloc);
+ }
+ else
+ {
+ t = idDecl_fixBase (t, processingType);
+ }
+
+ DPRINTF (("Declare: %s", idDecl_unparse (t)));
+
+ if (s_processingGlobals)
+ {
+ cstring id = idDecl_getName (t);
+ uentry ue = usymtab_lookupSafe (id);
+
+ if (!uentry_isValid (ue))
+ {
+ llerror (FLG_UNRECOG,
+ message ("Variable used in globals list is undeclared: %s", id));
+ }
+ else
+ {
+ if (!ctype_match (uentry_getType (ue), idDecl_getCtype (t)))
+ {
+ voptgenerror
+ (FLG_INCONDEFS,
+ message ("Variable %s used in globals list declared %s, "
+ "but listed as %s",
+ id, ctype_unparse (uentry_getType (ue)),
+ ctype_unparse (idDecl_getCtype (t))),
+ g_currentloc);
+ }
+ else
+ {
+ sRef sr = sRef_copy (uentry_getSref (ue));
+ reflectGlobalQualifiers (sr, idDecl_getQuals (t));
+ }
+ }
+ }
+ else if (s_processingVars)
+ {
+ processVariable (t);
+ }
+ else if (s_processingTypedef)
{
ctype ct = idDecl_getCtype (t);
uentry e;
bool processingIterVars (void)
{
- return ProcessingIterVars;
+ return s_processingIterVars;
}
uentry getCurrentIter (void)
cstring id = cstring_makeLiteral ("va_alist");
uentry e;
- if (ProcessingParams)
+ if (s_processingParams)
{
int i = uentryList_lookupRealName (saveParamList, id);