From 470b7798e9c04260b853bd5600fefc03abb04dfe Mon Sep 17 00:00:00 2001 From: drl7x Date: Sun, 29 Apr 2001 20:17:42 +0000 Subject: [PATCH] Added (limited) support for implicit annotations. Code works on shankly with gcc28 has problems other places. --- lib/ansi.h | 72 +- src/Headers/constraint.h | 10 +- src/Headers/constraintExpr.h | 6 +- src/Headers/constraintResolve.h | 1 + src/Headers/flag_codes.gen | 1 + src/Headers/herald.h | 2 +- src/Headers/herald.last | 2 +- src/Headers/multiVal.h | 1 + src/cgrammar.tab.c | 1172 ++++++++++++++++--------------- src/cgrammar.y | 6 +- src/clabstract.c | 41 ++ src/constraint.c | 75 +- src/constraintExpr.c | 16 +- src/constraintGeneration.c | 292 ++++++-- src/constraintResolve.c | 33 +- src/exprChecks.c | 15 +- src/exprNode.c | 6 +- src/flags.def | 9 + src/sRef.c | 3 +- src/uentry.c | 6 +- 20 files changed, 1067 insertions(+), 702 deletions(-) diff --git a/lib/ansi.h b/lib/ansi.h index ea5d709..10912df 100644 --- a/lib/ansi.h +++ b/lib/ansi.h @@ -452,7 +452,10 @@ extern int fgetc (FILE *stream) extern /*@null@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream) - /*@modifies fileSystem, *s, *stream, errno@*/ ; + /*@modifies fileSystem, *s, *stream, errno@*/ + /*@bufferConstraint MaxSet(s) >= (n -1); @*/ + /*@ensuresConstraint MaxRead(s) <= (n -1); MaxRead(s) >= 0; @*/ + ; extern int fputc (int /*@alt char@*/ c, FILE *stream) /*@modifies fileSystem, *stream, errno@*/ ; @@ -530,9 +533,18 @@ extern unsigned long extern int rand (void) /*@modifies internalState@*/ ; extern void srand (unsigned int seed) /*@modifies internalState@*/ ; -extern /*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/ ; -extern /*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@*/ ; +/* + drl + changed 12/29/2000 +*/ +extern /*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/ + /*@ensuresConstraint MaxSet(result) == nobj; @*/ ; +extern /*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@*/ + /*@ensuresConstraint MaxSet(result) == size; @*/ ; + +/*end drl changed */ + /* 11 June 1997: removed out on return value */ # if 0 @@ -826,28 +838,39 @@ extern size_t wcstombs (/*@out@*/ char *s, wchar_t *pwcs, size_t n) extern void /*@alt void * @*/ memcpy (/*@unique@*/ /*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n) - /*@modifies *s1@*/ ; + /*@modifies *s1@*/ + /*@bufferConstraint MaxRead(s2) >= n; MaxSet(s1) >= n; @*/ + ; extern void /*@alt void * @*/ memmove (/*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n) - /*@modifies *s1@*/ ; - + /*@modifies *s1@*/ + /*@bufferConstraint MaxRead(s2) >= n; MaxSet(s1) >= n; @*/ + ; + + + /* drl + modifed 12/29/2000 + */ + /* removed returned */ extern void /*@alt char * @*/ - strcpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2) - /*@modifies *s1@*/ ; + strcpy (/*@unique@*/ /*@out@*/ /*returned*/ char *s1, char *s2) + /*@modifies *s1@*/ /*@bufferConstraint MaxSet(s1) >= MaxRead(s2); @*/ /*@ensuresConstraint MaxRead(s1) == MaxRead (s2); MaxRead(result) == MaxRead(s2); MaxSet(result) == MaxSet(s1); @*/; extern void /*@alt char * @*/ - strncpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2, size_t n) - /*@modifies *s1@*/ ; + strncpy (/*@unique@*/ /*@out@*/ /*returned*/ char *s1, char *s2, size_t n) + /*@modifies *s1@*/ /*@bufferConstraint MaxSet(s1) >= ( n - 1 ); @*/ /*@ensuresConstraint MaxRead (s2) >= MaxRead(s1); MaxRead (s1) <= n; @*/; extern void /*@alt char * @*/ - strcat (/*@unique@*/ /*@returned@*/ /*@out@*/ char *s1, char *s2) - /*@modifies *s1@*/ ; + strcat (/*@unique@*/ /*returned*/ /*@out@*/ char *s1, char *s2) + /*@modifies *s1@*/ /*@bufferConstraint MaxSet(s1) >= (MaxRead(s1) + MaxRead(s2) ); */ /*ensuresConstraint MaxRead(result) = (MaxRead(s1) + MaxRead(s2) );@*/; extern void /*@alt char * @*/ - strncat (/*@unique@*/ /*@returned@*/ /*@out@*/ char *s1, char *s2, int n) - /*@modifies *s1@*/ ; + strncat (/*@unique@*/ /*returned*/ /*@out@*/ char *s1, char *s2, int n) + /*@modifies *s1@*/ /*@bufferConstraint MaxSet(s1) >= ( MaxRead(s1) + n); @*/ /*@ensuresConstraint MaxRead(result) >= (MaxRead(s1) + n); @*/; + /*drl end*/ + extern int memcmp (void *s1, void *s2, size_t n) /*@*/ ; extern int strcmp (char *s1, char *s2) /*@*/ ; extern int strcoll (char *s1, char *s2) /*@*/ ; @@ -859,10 +882,10 @@ extern /*@null@*/ void *memchr (void *s, int c, size_t n) /*@*/ ; # ifdef STRICT extern /*@exposed@*/ /*@null@*/ char * - strchr (/*@returned@*/ char *s, char c) /*@*/ ; +strchr (char *s, char c) /*@*//*@ensuresConstraint MaxSet(result) >= 0; MaxSet(result) <= MaxRead(s); MaxRead (result) <= MaxRead(s); MaxRead(result) >= 0; @*/ ; # else extern /*@exposed@*/ /*@null@*/ char * - strchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ ; + strchr ( char *s, int /*@alt char@*/ c) /*@*/ /*@ensuresConstraint MaxSet(result) >= 0; MaxSet(result) <= MaxRead(s); MaxRead (result) <= MaxRead(s); MaxRead(result) >= 0; @*/ ; # endif extern size_t strcspn (char *s1, char *s2) /*@*/ ; @@ -871,15 +894,18 @@ extern /*@null@*/ /*@exposed@*/ char * # ifdef STRICT extern /*@null@*/ /*@exposed@*/ char * - strrchr (/*@returned@*/ char *s, char c) /*@*/ ; + strrchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensuresConstraint MaxSet(result) >= 0; MaxSet(result) <= MaxRead(s); MaxRead (result) <= MaxRead(s); MaxRead(result) >= 0; @*/; # else extern /*@null@*/ /*@exposed@*/ char * - strrchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ ; + strrchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensuresConstraint MaxSet(result) >= 0; MaxSet(result) <= MaxRead(s); MaxRead (result) <= MaxRead(s); MaxRead(result) >= 0; @*/; # endif extern size_t strspn (char *s, char *t) /*@*/ ; + extern /*@null@*/ /*@exposed@*/ char * - strstr (/*@returned@*/ /*@unique@*/ char *s, char *t) /*@*/ ; + strstr (/*@returned@*/ /*@unique@*/ char *s, char *t) /*@*/ +/*@ensuresConstraint MaxSet(result) >= 0; MaxSet(result) <= MaxRead(s); MaxRead (result) <= MaxRead(s); MaxRead(result) >= 0; @*/; + extern /*@null@*/ /*@exposed@*/ char * strtok (/*@returned@*/ /*@null@*/ char *s, char *t) /*@modifies *s, internalState, errno@*/ ; @@ -890,7 +916,8 @@ extern void /*@alt void *@*/ memset (/*@out@*/ /*@returned@*/ void *s, extern /*@observer@*/ char *strerror (int errnum) /*@*/ ; -extern size_t strlen (char *s) /*@*/ ; +/*drl */ +extern size_t strlen (char *s) /*@*/ /*@ensuresConstraint result == MaxRead(s); @*/; /* ** time.h @@ -922,9 +949,10 @@ extern time_t time (/*@null@*/ /*@out@*/ time_t *tp) /*@modifies *tp@*/ ; extern /*@observer@*/ char *asctime (struct tm *timeptr) - /*@modifies errno*/ ; + /*@modifies errno*/ /*@ensuresConstraint MaxSet(result) == 25; MaxRead(result) == 25; @*/ ; -extern /*@observer@*/ char *ctime (time_t *tp) /*@*/ ; +extern /*@observer@*/ char *ctime (time_t *tp) /*@*/ + /*@ensuresConstraint MaxSet(result) == 25; MaxRead(result) == 25; @*/; extern /*@null@*/ /*@observer@*/ struct tm *gmtime (time_t *tp) /*@*/ ; diff --git a/src/Headers/constraint.h b/src/Headers/constraint.h index fb654c4..58b8de6 100644 --- a/src/Headers/constraint.h +++ b/src/Headers/constraint.h @@ -92,7 +92,7 @@ constraint constraint_makeEnsureGreaterThanEqual (exprNode e1, exprNode e2, file /*drl add 11/28/2000 */ constraint constraint_makeSRefWriteSafeInt (sRef s, int ind); - +constraint constraint_makeSRefReadSafeInt (sRef s, int ind); /*drl add 11/26/2000 */ void constraint_printError (constraint c, fileloc loc); constraint constraint_doSRefFixConstraintParam (constraint precondition, @@ -113,6 +113,14 @@ constraint constraint_addGeneratingExpr (/*@returned@*/ constraint c, exprNode e bool constraint_hasMaxSet(constraint c); +/*from constraintGenreation.c*/ +bool exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv, fileloc sequencePoint); + +constraintList exprNode_traversRequiresConstraints (exprNode e); +constraintList exprNode_traversEnsuresConstraints (exprNode e); + + + /*@=czechfcns*/ //#warning take this out #include "constraintList.h" diff --git a/src/Headers/constraintExpr.h b/src/Headers/constraintExpr.h index b3bb11b..6e84f9b 100644 --- a/src/Headers/constraintExpr.h +++ b/src/Headers/constraintExpr.h @@ -138,7 +138,7 @@ constraintExprData constraintExprData_unaryExprSetOp (constraintExprData data, constraintExprData constraintExprData_unaryExprSetExpr (constraintExprData data, constraintExpr expr); -constraintExprBinaryOpKind constraintExprData_binaryExprGetOp (constraintExprData data); /*@*/ +constraintExprBinaryOpKind constraintExprData_binaryExprGetOp (constraintExprData data) /*@*/; constraintExpr constraintExprData_binaryExprGetExpr1 (constraintExprData data)/*@*/; @@ -170,4 +170,8 @@ constraintExpr constraintExpr_parseMakeBinaryOp (constraintExpr expr1, lltok op, bool constraintExpr_hasMaxSet (constraintExpr expr); +constraintExpr constraintExpr_propagateConstants (constraintExpr expr, + /*@out@*/ bool * propagate, + /*@out@*/ int *literal); + #endif diff --git a/src/Headers/constraintResolve.h b/src/Headers/constraintResolve.h index 8f5de87..6dce56d 100644 --- a/src/Headers/constraintResolve.h +++ b/src/Headers/constraintResolve.h @@ -16,3 +16,4 @@ extern constraintList constraintList_subsumeEnsures (constraintList list1, const extern constraintList constraintList_mergeEnsures (constraintList list1, constraintList list2); bool constraint_isAlwaysTrue (constraint c); +constraintList constraintList_mergeRequires (constraintList list1, constraintList list2); diff --git a/src/Headers/flag_codes.gen b/src/Headers/flag_codes.gen index 323bf8d..f9db498 100644 --- a/src/Headers/flag_codes.gen +++ b/src/Headers/flag_codes.gen @@ -321,6 +321,7 @@ FLG_FUNCTIONPOST, FLG_FUNCTIONCONSTRAINT, FLG_CONSTRAINTLOCATION, + FLG_IMPLICTCONSTRAINT, FLG_NULLTERMINATEDWARNING, FLG_NULLDEREF, FLG_FCNDEREF, diff --git a/src/Headers/herald.h b/src/Headers/herald.h index 207b2aa..1326d5c 100644 --- a/src/Headers/herald.h +++ b/src/Headers/herald.h @@ -4,4 +4,4 @@ /*@constant observer char *LCL_PARSE_VERSION;@*/ # define LCL_PARSE_VERSION "LCLint 2.5q" /*@constant observer char *LCL_COMPILE;@*/ -# define LCL_COMPILE "Compiled using /opt/GCC281/bin/gcc -DSTDC_HEADERS=1 -g -Wall on SunOS mamba.cs.Virginia.EDU 5.6 Generic_105181-09 sun4u sparc SUNW,Ultra-60 by drl7x" +# define LCL_COMPILE "Compiled using gcc28 -DSTDC_HEADERS=1 -g -Wall on FreeBSD shankly.cs.virginia.edu 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Tue May 18 04:05:08 GMT 1999 jkh@cathair:/usr/src/sys/compile/GENERIC i386 by drl7x" diff --git a/src/Headers/herald.last b/src/Headers/herald.last index 207b2aa..117a593 100644 --- a/src/Headers/herald.last +++ b/src/Headers/herald.last @@ -4,4 +4,4 @@ /*@constant observer char *LCL_PARSE_VERSION;@*/ # define LCL_PARSE_VERSION "LCLint 2.5q" /*@constant observer char *LCL_COMPILE;@*/ -# define LCL_COMPILE "Compiled using /opt/GCC281/bin/gcc -DSTDC_HEADERS=1 -g -Wall on SunOS mamba.cs.Virginia.EDU 5.6 Generic_105181-09 sun4u sparc SUNW,Ultra-60 by drl7x" +# define LCL_COMPILE "Compiled using gcc -DSTDC_HEADERS=1 -g -Wall on FreeBSD shankly.cs.virginia.edu 3.2-RELEASE FreeBSD 3.2-RELEASE #0: Tue May 18 04:05:08 GMT 1999 jkh@cathair:/usr/src/sys/compile/GENERIC i386 by drl7x" diff --git a/src/Headers/multiVal.h b/src/Headers/multiVal.h index 735b05e..487f829 100644 --- a/src/Headers/multiVal.h +++ b/src/Headers/multiVal.h @@ -17,6 +17,7 @@ typedef /*@null@*/ struct _multiVal double fval; /*@only@*/ cstring sval; } value; + } *multiVal; extern /*@falsenull@*/ bool multiVal_isDefined (multiVal p_m) /*@*/ ; diff --git a/src/cgrammar.tab.c b/src/cgrammar.tab.c index cce51ad..1b0ba1f 100644 --- a/src/cgrammar.tab.c +++ b/src/cgrammar.tab.c @@ -638,71 +638,71 @@ static const short yyrhs[] = { -1, static const short yyrline[] = { 0, 269, 270, 273, 274, 277, 278, 279, 280, 281, 282, 283, 286, 288, 292, 292, 297, 303, 307, 308, 312, - 313, 315, 317, 321, 324, 332, 335, 344, 345, 347, - 349, 365, 369, 376, 380, 386, 388, 388, 392, 393, - 394, 395, 398, 401, 402, 408, 409, 413, 417, 422, - 429, 433, 438, 445, 448, 449, 452, 457, 458, 461, - 462, 463, 466, 467, 468, 473, 474, 482, 485, 487, - 488, 493, 494, 495, 497, 513, 517, 518, 523, 524, - 534, 535, 538, 539, 542, 543, 546, 547, 550, 551, - 554, 557, 558, 561, 562, 563, 564, 565, 568, 569, - 572, 572, 575, 575, 578, 582, 583, 586, 586, 589, - 589, 592, 596, 597, 600, 601, 604, 610, 617, 623, - 630, 631, 632, 633, 634, 637, 640, 643, 644, 647, - 648, 649, 650, 651, 652, 653, 654, 657, 663, 670, - 676, 685, 691, 695, 697, 701, 704, 711, 721, 722, - 725, 726, 729, 730, 731, 732, 733, 734, 735, 736, - 740, 741, 745, 746, 749, 751, 753, 754, 755, 756, - 757, 759, 763, 767, 779, 780, 781, 782, 783, 784, - 787, 788, 789, 790, 791, 792, 793, 794, 795, 798, - 799, 802, 803, 804, 805, 806, 807, 808, 809, 810, - 811, 812, 815, 816, 819, 823, 824, 827, 828, 829, - 830, 833, 834, 838, 839, 840, 841, 844, 845, 846, - 849, 850, 851, 854, 855, 856, 857, 858, 861, 862, - 863, 866, 867, 870, 871, 875, 876, 879, 880, 885, - 891, 892, 898, 904, 905, 905, 907, 910, 911, 912, - 913, 914, 915, 916, 917, 918, 919, 920, 921, 924, - 925, 928, 929, 932, 937, 938, 939, 942, 955, 959, - 960, 963, 968, 969, 969, 974, 975, 976, 977, 980, - 983, 986, 989, 990, 993, 994, 997, 998, 999, 1003, - 1005, 1014, 1015, 1016, 1017, 1018, 1021, 1022, 1023, 1024, - 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, - 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, - 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, - 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, - 1065, 1066, 1072, 1073, 1074, 1075, 1078, 1079, 1080, 1081, - 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, - 1094, 1098, 1099, 1103, 1104, 1108, 1109, 1110, 1113, 1114, - 1117, 1119, 1121, 1122, 1124, 1126, 1127, 1129, 1131, 1133, - 1135, 1136, 1138, 1140, 1141, 1143, 1145, 1146, 1149, 1152, - 1153, 1154, 1157, 1159, 1163, 1165, 1169, 1170, 1171, 1175, - 1177, 1177, 1179, 1182, 1184, 1186, 1189, 1194, 1201, 1202, - 1203, 1210, 1214, 1215, 1219, 1220, 1223, 1224, 1227, 1228, - 1231, 1232, 1233, 1234, 1237, 1238, 1241, 1242, 1245, 1246, - 1247, 1250, 1250, 1251, 1252, 1255, 1267, 1283, 1284, 1287, - 1288, 1289, 1292, 1293, 1296, 1298, 1299, 1301, 1302, 1304, - 1306, 1308, 1310, 1316, 1317, 1318, 1319, 1320, 1321, 1322, - 1323, 1324, 1339, 1344, 1347, 1350, 1351, 1355, 1357, 1359, - 1361, 1365, 1366, 1368, 1372, 1374, 1376, 1379, 1380, 1381, - 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, - 1394, 1400, 1403, 1406, 1407, 1410, 1411, 1412, 1413, 1414, - 1415, 1416, 1417, 1418, 1419, 1420, 1423, 1424, 1430, 1431, - 1432, 1433, 1436, 1437, 1438, 1439, 1442, 1443, 1447, 1450, - 1453, 1456, 1459, 1462, 1465, 1466, 1467, 1468, 1470, 1471, - 1473, 1475, 1482, 1486, 1488, 1490, 1492, 1496, 1497, 1500, - 1501, 1504, 1505, 1508, 1509, 1512, 1513, 1514, 1517, 1525, - 1530, 1531, 1535, 1536, 1539, 1544, 1547, 1548, 1549, 1557, - 1558, 1558, 1562, 1563, 1564, 1575, 1582, 1583, 1586, 1587, - 1588, 1589, 1590, 1592, 1593, 1594, 1595, 1598, 1599, 1600, - 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1610, 1611, 1614, - 1615, 1616, 1617, 1620, 1621, 1622, 1625, 1626, 1627, 1630, - 1631, 1632, 1633, 1634, 1637, 1638, 1639, 1642, 1643, 1646, - 1647, 1651, 1652, 1655, 1656, 1659, 1660, 1663, 1664, 1665, - 1666, 1669, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, - 1678, 1679, 1680, 1683, 1684, 1687, 1690, 1692, 1694, 1698, - 1699, 1701, 1703, 1706, 1707, 1708, 1710, 1711, 1712, 1713, - 1714, 1715, 1716, 1719, 1720, 1723, 1726, 1727, 1728, 1729, - 1730, 1733, 1734 + 313, 315, 317, 321, 324, 332, 336, 346, 347, 349, + 351, 367, 371, 378, 382, 388, 390, 390, 394, 395, + 396, 397, 400, 403, 404, 410, 411, 415, 419, 424, + 431, 435, 440, 447, 450, 451, 454, 459, 460, 463, + 464, 465, 468, 469, 470, 475, 476, 484, 487, 489, + 490, 495, 496, 497, 499, 515, 519, 520, 525, 526, + 536, 537, 540, 541, 544, 545, 548, 549, 552, 553, + 556, 559, 560, 563, 564, 565, 566, 567, 570, 571, + 574, 574, 577, 577, 580, 584, 585, 588, 588, 591, + 591, 594, 598, 599, 602, 603, 606, 612, 619, 625, + 632, 633, 634, 635, 636, 639, 642, 645, 646, 649, + 650, 651, 652, 653, 654, 655, 656, 659, 665, 672, + 678, 687, 693, 697, 699, 703, 706, 713, 723, 724, + 727, 728, 731, 732, 733, 734, 735, 736, 737, 738, + 742, 743, 747, 748, 751, 753, 755, 756, 757, 758, + 759, 761, 765, 769, 781, 782, 783, 784, 785, 786, + 789, 790, 791, 792, 793, 794, 795, 796, 797, 800, + 801, 804, 805, 806, 807, 808, 809, 810, 811, 812, + 813, 814, 817, 818, 821, 825, 826, 829, 830, 831, + 832, 835, 836, 840, 841, 842, 843, 846, 847, 848, + 851, 852, 853, 856, 857, 858, 859, 860, 863, 864, + 865, 868, 869, 872, 873, 877, 878, 881, 882, 887, + 893, 894, 900, 906, 907, 907, 909, 912, 913, 914, + 915, 916, 917, 918, 919, 920, 921, 922, 923, 926, + 927, 930, 931, 934, 939, 940, 941, 944, 957, 961, + 962, 965, 970, 971, 971, 976, 977, 978, 979, 982, + 985, 988, 991, 992, 995, 996, 999, 1000, 1001, 1005, + 1007, 1016, 1017, 1018, 1019, 1020, 1023, 1024, 1025, 1026, + 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, + 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, + 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, + 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, + 1067, 1068, 1074, 1075, 1076, 1077, 1080, 1081, 1082, 1083, + 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, + 1096, 1100, 1101, 1105, 1106, 1110, 1111, 1112, 1115, 1116, + 1119, 1121, 1123, 1124, 1126, 1128, 1129, 1131, 1133, 1135, + 1137, 1138, 1140, 1142, 1143, 1145, 1147, 1148, 1151, 1154, + 1155, 1156, 1159, 1161, 1165, 1167, 1171, 1172, 1173, 1177, + 1179, 1179, 1181, 1184, 1186, 1188, 1191, 1196, 1203, 1204, + 1205, 1212, 1216, 1217, 1221, 1222, 1225, 1226, 1229, 1230, + 1233, 1234, 1235, 1236, 1239, 1240, 1243, 1244, 1247, 1248, + 1249, 1252, 1252, 1253, 1254, 1257, 1269, 1285, 1286, 1289, + 1290, 1291, 1294, 1295, 1298, 1300, 1301, 1303, 1304, 1306, + 1308, 1310, 1312, 1318, 1319, 1320, 1321, 1322, 1323, 1324, + 1325, 1326, 1341, 1346, 1349, 1352, 1353, 1357, 1359, 1361, + 1363, 1367, 1368, 1370, 1374, 1376, 1378, 1381, 1382, 1383, + 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1391, 1392, 1393, + 1396, 1402, 1405, 1408, 1409, 1412, 1413, 1414, 1415, 1416, + 1417, 1418, 1419, 1420, 1421, 1422, 1425, 1426, 1432, 1433, + 1434, 1435, 1438, 1439, 1440, 1441, 1444, 1445, 1449, 1452, + 1455, 1458, 1461, 1464, 1467, 1468, 1469, 1470, 1472, 1473, + 1475, 1477, 1484, 1488, 1490, 1492, 1494, 1498, 1499, 1502, + 1503, 1506, 1507, 1510, 1511, 1514, 1515, 1516, 1519, 1527, + 1532, 1533, 1537, 1538, 1541, 1546, 1549, 1550, 1551, 1559, + 1560, 1560, 1564, 1565, 1566, 1577, 1584, 1585, 1588, 1589, + 1590, 1591, 1592, 1594, 1595, 1596, 1597, 1600, 1601, 1602, + 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1612, 1613, 1616, + 1617, 1618, 1619, 1622, 1623, 1624, 1627, 1628, 1629, 1632, + 1633, 1634, 1635, 1636, 1639, 1640, 1641, 1644, 1645, 1648, + 1649, 1653, 1654, 1657, 1658, 1661, 1662, 1665, 1666, 1667, + 1668, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, + 1680, 1681, 1682, 1685, 1686, 1689, 1692, 1694, 1696, 1700, + 1701, 1703, 1705, 1708, 1709, 1710, 1712, 1713, 1714, 1715, + 1716, 1717, 1718, 1721, 1722, 1725, 1728, 1729, 1730, 1731, + 1732, 1735, 1736 }; #endif @@ -2597,7 +2597,7 @@ static const short yycheck[] = { 0, 185, -1, -1, -1, 189 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/gnu/share/bison.simple" +#line 3 "/usr/share/misc/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. @@ -2790,7 +2790,7 @@ __yy_memcpy (char *to, char *from, int count) #endif #endif -#line 196 "/gnu/share/bison.simple" +#line 196 "/usr/share/misc/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -3190,12 +3190,14 @@ case 25: break;} case 26: #line 333 "cgrammar.y" -{ setCurrentParams (yyvsp[-1].entrylist); +{ setCurrentParams (yyvsp[-1].entrylist); + ; break;} case 27: -#line 336 "cgrammar.y" -{ clearCurrentParams (); +#line 337 "cgrammar.y" +{ setImplictfcnConstraints (); + clearCurrentParams (); yyval.ntyp = idDecl_replaceCtype (yyvsp[-7].ntyp, ctype_makeFunction (idDecl_getCtype (yyvsp[-7].ntyp), yyvsp[-4].entrylist)); context_popLoc (); @@ -3203,19 +3205,19 @@ case 27: ; break;} case 28: -#line 344 "cgrammar.y" +#line 346 "cgrammar.y" { yyval.ntyp = idDecl_create (yyvsp[0].cname, qtype_unknown ()); ; break;} case 29: -#line 346 "cgrammar.y" +#line 348 "cgrammar.y" { yyval.ntyp = idDecl_expectFunction (yyvsp[-2].ntyp); ; break;} case 30: -#line 348 "cgrammar.y" +#line 350 "cgrammar.y" { yyval.ntyp = idDecl_replaceCtype (yyvsp[-2].ntyp, ctype_makeArray (idDecl_getCtype (yyvsp[-2].ntyp))); ; break;} case 31: -#line 350 "cgrammar.y" +#line 352 "cgrammar.y" { int value; @@ -3233,12 +3235,12 @@ case 31: ; break;} case 32: -#line 366 "cgrammar.y" +#line 368 "cgrammar.y" { setCurrentParams (uentryList_missingParams); ; break;} case 33: -#line 369 "cgrammar.y" +#line 371 "cgrammar.y" { /* need to support globals and modifies here! */ ctype ct = ctype_makeFunction (idDecl_getCtype (yyvsp[-5].ntyp), uentryList_makeMissingParams ()); @@ -3248,67 +3250,67 @@ case 33: ; break;} case 34: -#line 377 "cgrammar.y" +#line 379 "cgrammar.y" { setCurrentParams (yyvsp[-1].entrylist); ; break;} case 35: -#line 380 "cgrammar.y" +#line 382 "cgrammar.y" { clearCurrentParams (); yyval.ntyp = idDecl_replaceCtype (yyvsp[-6].ntyp, ctype_makeFunction (idDecl_getCtype (yyvsp[-6].ntyp), yyvsp[-3].entrylist)); context_popLoc (); ; break;} case 36: -#line 387 "cgrammar.y" +#line 389 "cgrammar.y" { setCurrentParams (yyvsp[-1].entrylist); ; break;} case 37: -#line 388 "cgrammar.y" +#line 390 "cgrammar.y" { clearCurrentParams (); ; break;} case 38: -#line 389 "cgrammar.y" +#line 391 "cgrammar.y" { declareCIter (yyvsp[-8].cname, yyvsp[-6].entrylist); ; break;} case 39: -#line 392 "cgrammar.y" +#line 394 "cgrammar.y" { exprNode_checkMacroBody (yyvsp[-1].expr); ; break;} case 40: -#line 393 "cgrammar.y" +#line 395 "cgrammar.y" { exprNode_checkIterBody (yyvsp[-1].expr); ; break;} case 41: -#line 394 "cgrammar.y" +#line 396 "cgrammar.y" { exprNode_checkIterEnd (yyvsp[-1].expr); ; break;} case 42: -#line 395 "cgrammar.y" +#line 397 "cgrammar.y" { exprChecks_checkEmptyMacroBody (); ; break;} case 43: -#line 398 "cgrammar.y" +#line 400 "cgrammar.y" { declareFunction (yyvsp[0].ntyp); ; break;} case 44: -#line 401 "cgrammar.y" +#line 403 "cgrammar.y" { setProcessingGlobMods (); ; break;} case 45: -#line 402 "cgrammar.y" +#line 404 "cgrammar.y" { clearProcessingGlobMods (); ; break;} case 46: -#line 408 "cgrammar.y" +#line 410 "cgrammar.y" { setProcessingGlobMods (); ; break;} case 47: -#line 409 "cgrammar.y" +#line 411 "cgrammar.y" { clearProcessingGlobMods (); ; break;} case 49: -#line 417 "cgrammar.y" +#line 419 "cgrammar.y" { DPRINTF ( ("doing optGlobEnsuresConstraintsAux\n") ); context_setProtectVars (); enterParamsTemp (); @@ -3317,7 +3319,7 @@ context_setProtectVars (); enterParamsTemp (); ; break;} case 50: -#line 423 "cgrammar.y" +#line 425 "cgrammar.y" { setEnsuresConstraints (yyvsp[-1].conL); exitParamsTemp (); @@ -3326,7 +3328,7 @@ case 50: DPRINTF (("done optGlobBufConstraintsAux\n"));; break;} case 52: -#line 433 "cgrammar.y" +#line 435 "cgrammar.y" { DPRINTF ( ("doing optGlobBufConstraintsAux\n") ); context_setProtectVars (); enterParamsTemp (); @@ -3335,7 +3337,7 @@ context_setProtectVars (); enterParamsTemp (); ; break;} case 53: -#line 439 "cgrammar.y" +#line 441 "cgrammar.y" { setFunctionConstraints (yyvsp[-1].conL); exitParamsTemp (); @@ -3344,35 +3346,35 @@ case 53: DPRINTF (("done optGlobBufConstraintsAux\n"));; break;} case 55: -#line 448 "cgrammar.y" +#line 450 "cgrammar.y" { yyval.conL = constraintList_add (yyvsp[0].conL, yyvsp[-1].con); ; break;} case 56: -#line 449 "cgrammar.y" +#line 451 "cgrammar.y" {constraintList c; c = constraintList_new(); c = constraintList_add (c, yyvsp[0].con); yyval.conL = c; break;} case 57: -#line 452 "cgrammar.y" +#line 454 "cgrammar.y" { yyval.con = makeConstraintParse3 (yyvsp[-3].conE, yyvsp[-2].tok, yyvsp[-1].conE); DPRINTF(("Done BufConstraint1\n")); ; break;} case 64: -#line 467 "cgrammar.y" +#line 469 "cgrammar.y" {yyval.conE = constraintExpr_parseMakeUnaryOp (yyvsp[-3].tok, yyvsp[-1].conE); DPRINTF( ("Got BufConstraintExpr UNary Op ") ); ; break;} case 65: -#line 468 "cgrammar.y" +#line 470 "cgrammar.y" { DPRINTF( ("Got BufConstraintExpr BINary Op ") ); yyval.conE = constraintExpr_parseMakeBinaryOp (yyvsp[-3].conE, yyvsp[-2].tok, yyvsp[-1].conE); ; break;} case 66: -#line 473 "cgrammar.y" +#line 475 "cgrammar.y" { yyval.conE = constraintExpr_makeTermsRef(yyvsp[0].sr);; break;} case 67: -#line 474 "cgrammar.y" +#line 476 "cgrammar.y" { char *t; int c; t = cstring_toCharsSafe (exprNode_unparse(yyvsp[0].expr)); c = atoi( t ); @@ -3380,21 +3382,21 @@ case 67: ; break;} case 68: -#line 482 "cgrammar.y" +#line 484 "cgrammar.y" { yyval.sr = checkbufferConstraintClausesId (yyvsp[0].entry);; break;} case 69: -#line 485 "cgrammar.y" +#line 487 "cgrammar.y" { yyval.sr = fixSpecClausesId (yyvsp[0].cname); ; break;} case 70: -#line 487 "cgrammar.y" +#line 489 "cgrammar.y" { yyval.sr = sRef_makeAnyArrayFetch (yyvsp[-2].sr); ; break;} case 71: -#line 488 "cgrammar.y" +#line 490 "cgrammar.y" { char *t; int c; t = cstring_toCharsSafe (exprNode_unparse(yyvsp[-1].expr)); @@ -3402,140 +3404,140 @@ case 71: yyval.sr = sRef_makeArrayFetchKnown(yyvsp[-3].sr, c); ; break;} case 72: -#line 493 "cgrammar.y" +#line 495 "cgrammar.y" { yyval.sr = sRef_constructPointer (yyvsp[0].sr); ; break;} case 73: -#line 494 "cgrammar.y" +#line 496 "cgrammar.y" { yyval.sr = yyvsp[-1].sr; ; break;} case 74: -#line 495 "cgrammar.y" +#line 497 "cgrammar.y" { cstring_markOwned (yyvsp[0].cname); yyval.sr = sRef_buildField (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 75: -#line 497 "cgrammar.y" +#line 499 "cgrammar.y" { cstring_markOwned (yyvsp[0].cname); yyval.sr = sRef_makeArrow (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 79: -#line 523 "cgrammar.y" +#line 525 "cgrammar.y" { setProcessingGlobMods (); ; break;} case 80: -#line 524 "cgrammar.y" +#line 526 "cgrammar.y" { clearProcessingGlobMods (); ; break;} case 81: -#line 534 "cgrammar.y" +#line 536 "cgrammar.y" { setProcessingGlobMods (); ; break;} case 82: -#line 535 "cgrammar.y" +#line 537 "cgrammar.y" { clearProcessingGlobMods (); ; break;} case 89: -#line 550 "cgrammar.y" +#line 552 "cgrammar.y" { ; ; break;} case 90: -#line 551 "cgrammar.y" +#line 553 "cgrammar.y" { ; ; break;} case 91: -#line 554 "cgrammar.y" +#line 556 "cgrammar.y" { globListAdd (yyvsp[0].sr, yyvsp[-1].tquallist); ; break;} case 92: -#line 557 "cgrammar.y" +#line 559 "cgrammar.y" { yyval.sr = uentry_getSref (yyvsp[0].entry); ; break;} case 93: -#line 558 "cgrammar.y" +#line 560 "cgrammar.y" { yyval.sr = globListUnrecognized (yyvsp[0].cname); ; break;} case 94: -#line 561 "cgrammar.y" +#line 563 "cgrammar.y" { yyval.typequal = qual_createUndef (); ; break;} case 95: -#line 562 "cgrammar.y" +#line 564 "cgrammar.y" { yyval.typequal = qual_createKilled (); ; break;} case 96: -#line 563 "cgrammar.y" +#line 565 "cgrammar.y" { yyval.typequal = qual_createOut (); ; break;} case 97: -#line 564 "cgrammar.y" +#line 566 "cgrammar.y" { yyval.typequal = qual_createIn (); ; break;} case 98: -#line 565 "cgrammar.y" +#line 567 "cgrammar.y" { yyval.typequal = qual_createPartial (); ; break;} case 99: -#line 568 "cgrammar.y" +#line 570 "cgrammar.y" { yyval.tquallist = qualList_undefined; ; break;} case 100: -#line 569 "cgrammar.y" +#line 571 "cgrammar.y" { yyval.tquallist = qualList_add (yyvsp[0].tquallist, yyvsp[-1].typequal); ; break;} case 101: -#line 572 "cgrammar.y" +#line 574 "cgrammar.y" { setProcessingGlobalsList (); ; break;} case 102: -#line 574 "cgrammar.y" +#line 576 "cgrammar.y" { unsetProcessingGlobals (); ; break;} case 103: -#line 575 "cgrammar.y" +#line 577 "cgrammar.y" { setProcessingGlobalsList (); ; break;} case 104: -#line 577 "cgrammar.y" +#line 579 "cgrammar.y" { unsetProcessingGlobals (); ; break;} case 105: -#line 579 "cgrammar.y" +#line 581 "cgrammar.y" { setFunctionNoGlobals (); setFunctionModifies (sRefSet_single (sRef_makeNothing ())); ; break;} case 108: -#line 586 "cgrammar.y" +#line 588 "cgrammar.y" { setProcessingGlobalsList (); ; break;} case 109: -#line 588 "cgrammar.y" +#line 590 "cgrammar.y" { unsetProcessingGlobals (); ; break;} case 110: -#line 589 "cgrammar.y" +#line 591 "cgrammar.y" { setProcessingGlobalsList (); ; break;} case 111: -#line 591 "cgrammar.y" +#line 593 "cgrammar.y" { unsetProcessingGlobals (); ; break;} case 112: -#line 593 "cgrammar.y" +#line 595 "cgrammar.y" { setFunctionNoGlobals (); setFunctionModifies (sRefSet_single (sRef_makeNothing ())); ; break;} case 117: -#line 605 "cgrammar.y" +#line 607 "cgrammar.y" { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ; break;} case 118: -#line 610 "cgrammar.y" +#line 612 "cgrammar.y" { setFunctionModifies (yyvsp[0].srset); exitParamsTemp (); sRef_clearGlobalScopeSafe (); @@ -3543,14 +3545,14 @@ case 118: ; break;} case 119: -#line 618 "cgrammar.y" +#line 620 "cgrammar.y" { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ; break;} case 120: -#line 623 "cgrammar.y" +#line 625 "cgrammar.y" { setFunctionModifies (yyvsp[0].srset); exitParamsTemp (); sRef_clearGlobalScopeSafe (); @@ -3558,39 +3560,39 @@ case 120: ; break;} case 130: -#line 647 "cgrammar.y" +#line 649 "cgrammar.y" { yyval.sck = SP_ISONLY; ; break;} case 131: -#line 648 "cgrammar.y" +#line 650 "cgrammar.y" { yyval.sck = SP_ISOBSERVER; ; break;} case 132: -#line 649 "cgrammar.y" +#line 651 "cgrammar.y" { yyval.sck = SP_ISEXPOSED; ; break;} case 133: -#line 650 "cgrammar.y" +#line 652 "cgrammar.y" { yyval.sck = SP_ISDEPENDENT; ; break;} case 134: -#line 651 "cgrammar.y" +#line 653 "cgrammar.y" { yyval.sck = SP_ISOWNED; ; break;} case 135: -#line 652 "cgrammar.y" +#line 654 "cgrammar.y" { yyval.sck = SP_ISSHARED; ; break;} case 136: -#line 653 "cgrammar.y" +#line 655 "cgrammar.y" { yyval.sck = SP_ISNULL; ; break;} case 137: -#line 654 "cgrammar.y" +#line 656 "cgrammar.y" { yyval.sck = SP_ISNOTNULL; ; break;} case 138: -#line 658 "cgrammar.y" +#line 660 "cgrammar.y" { context_setProtectVars (); enterParamsTemp (); @@ -3598,7 +3600,7 @@ case 138: ; break;} case 139: -#line 664 "cgrammar.y" +#line 666 "cgrammar.y" { setFunctionSpecialClause (yyvsp[-6].tok, yyvsp[-3].srset, yyvsp[-1].tok); exitParamsTemp (); @@ -3607,7 +3609,7 @@ case 139: ; break;} case 140: -#line 671 "cgrammar.y" +#line 673 "cgrammar.y" { context_setProtectVars (); enterParamsTemp (); @@ -3615,7 +3617,7 @@ case 140: ; break;} case 141: -#line 677 "cgrammar.y" +#line 679 "cgrammar.y" { setFunctionStateSpecialClause (yyvsp[-7].tok, yyvsp[-5].sck, yyvsp[-3].srset, yyvsp[-1].tok); exitParamsTemp (); @@ -3624,7 +3626,7 @@ case 141: ; break;} case 142: -#line 686 "cgrammar.y" +#line 688 "cgrammar.y" { qtype qint = qtype_create (ctype_int); yyval.ntyp = idDecl_fixBase (yyvsp[0].ntyp, qint); @@ -3632,26 +3634,26 @@ case 142: ; break;} case 143: -#line 692 "cgrammar.y" +#line 694 "cgrammar.y" { yyval.ntyp = idDecl_fixBase (yyvsp[0].ntyp, yyvsp[-2].qtyp); ; break;} case 144: -#line 695 "cgrammar.y" +#line 697 "cgrammar.y" { checkDoneParams (); context_enterInnerContext (); ; break;} case 145: -#line 697 "cgrammar.y" +#line 699 "cgrammar.y" { exprNode_checkFunctionBody (yyvsp[0].expr); yyval.expr = yyvsp[0].expr; context_exitInner (yyvsp[0].expr); ; break;} case 146: -#line 702 "cgrammar.y" +#line 704 "cgrammar.y" { doneParams (); context_enterInnerContext (); ; break;} case 147: -#line 704 "cgrammar.y" +#line 706 "cgrammar.y" { context_exitInner (yyvsp[0].expr); exprNode_checkFunctionBody (yyvsp[0].expr); @@ -3659,7 +3661,7 @@ case 147: ; break;} case 148: -#line 712 "cgrammar.y" +#line 714 "cgrammar.y" { context_setFunctionDefined (exprNode_loc (yyvsp[0].expr)); /* exprNode_checkFunction (context_getHeader (), $2); */ @@ -3669,111 +3671,111 @@ case 148: ; break;} case 149: -#line 721 "cgrammar.y" +#line 723 "cgrammar.y" { yyval.srset = yyvsp[-2].srset; ; break;} case 150: -#line 722 "cgrammar.y" +#line 724 "cgrammar.y" { yyval.srset = sRefSet_new (); ; break;} case 151: -#line 725 "cgrammar.y" +#line 727 "cgrammar.y" { yyval.srset = yyvsp[-1].srset; ; break;} case 152: -#line 726 "cgrammar.y" +#line 728 "cgrammar.y" { yyval.srset = sRefSet_new (); ; break;} case 153: -#line 729 "cgrammar.y" +#line 731 "cgrammar.y" { yyval.sr = uentry_getSref (yyvsp[0].entry); checkModifiesId (yyvsp[0].entry); ; break;} case 154: -#line 730 "cgrammar.y" +#line 732 "cgrammar.y" { yyval.sr = fixModifiesId (yyvsp[0].cname); ; break;} case 155: -#line 731 "cgrammar.y" +#line 733 "cgrammar.y" { yyval.sr = modListArrayFetch (yyvsp[-2].sr, sRef_undefined); ; break;} case 156: -#line 732 "cgrammar.y" +#line 734 "cgrammar.y" { yyval.sr = modListArrayFetch (yyvsp[-3].sr, yyvsp[-1].sr); ; break;} case 157: -#line 733 "cgrammar.y" +#line 735 "cgrammar.y" { yyval.sr = modListPointer (yyvsp[0].sr); ; break;} case 158: -#line 734 "cgrammar.y" +#line 736 "cgrammar.y" { yyval.sr = yyvsp[-1].sr; ; break;} case 159: -#line 735 "cgrammar.y" +#line 737 "cgrammar.y" { yyval.sr = modListFieldAccess (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 160: -#line 736 "cgrammar.y" +#line 738 "cgrammar.y" { yyval.sr = modListArrowAccess (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 161: -#line 740 "cgrammar.y" +#line 742 "cgrammar.y" { yyval.sr = yyvsp[0].sr; ; break;} case 162: -#line 741 "cgrammar.y" +#line 743 "cgrammar.y" { yyval.sr = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ ; break;} case 163: -#line 745 "cgrammar.y" +#line 747 "cgrammar.y" { yyval.srset = sRefSet_single (yyvsp[0].sr); ; break;} case 164: -#line 746 "cgrammar.y" +#line 748 "cgrammar.y" { yyval.srset = sRefSet_insert (yyvsp[-2].srset, yyvsp[0].sr); ; break;} case 165: -#line 750 "cgrammar.y" +#line 752 "cgrammar.y" { yyval.sr = checkSpecClausesId (yyvsp[0].entry); ; break;} case 166: -#line 752 "cgrammar.y" +#line 754 "cgrammar.y" { yyval.sr = fixSpecClausesId (yyvsp[0].cname); ; break;} case 167: -#line 753 "cgrammar.y" +#line 755 "cgrammar.y" { yyval.sr = sRef_makeAnyArrayFetch (yyvsp[-2].sr); ; break;} case 168: -#line 754 "cgrammar.y" +#line 756 "cgrammar.y" { yyval.sr = sRef_makeAnyArrayFetch (yyvsp[-3].sr); ; break;} case 169: -#line 755 "cgrammar.y" +#line 757 "cgrammar.y" { yyval.sr = sRef_constructPointer (yyvsp[0].sr); ; break;} case 170: -#line 756 "cgrammar.y" +#line 758 "cgrammar.y" { yyval.sr = yyvsp[-1].sr; ; break;} case 171: -#line 757 "cgrammar.y" +#line 759 "cgrammar.y" { cstring_markOwned (yyvsp[0].cname); yyval.sr = sRef_buildField (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 172: -#line 759 "cgrammar.y" +#line 761 "cgrammar.y" { cstring_markOwned (yyvsp[0].cname); yyval.sr = sRef_makeArrow (yyvsp[-2].sr, yyvsp[0].cname); ; break;} case 173: -#line 764 "cgrammar.y" +#line 766 "cgrammar.y" { if (sRef_isValid (yyvsp[0].sr)) { yyval.srset = sRefSet_single (yyvsp[0].sr); } else { yyval.srset = sRefSet_undefined; } ; break;} case 174: -#line 768 "cgrammar.y" +#line 770 "cgrammar.y" { if (sRef_isValid (yyvsp[0].sr)) { yyval.srset = sRefSet_insert (yyvsp[-2].srset, yyvsp[0].sr); @@ -3785,849 +3787,849 @@ case 174: ; break;} case 175: -#line 779 "cgrammar.y" +#line 781 "cgrammar.y" { yyval.expr = exprNode_fromIdentifier (yyvsp[0].entry); ; break;} case 176: -#line 780 "cgrammar.y" +#line 782 "cgrammar.y" { yyval.expr = exprNode_fromUIO (yyvsp[0].cname); ; break;} case 177: -#line 781 "cgrammar.y" +#line 783 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 178: -#line 782 "cgrammar.y" +#line 784 "cgrammar.y" { yyval.expr = exprNode_addParens (yyvsp[-2].tok, yyvsp[-1].expr); ; break;} case 179: -#line 783 "cgrammar.y" +#line 785 "cgrammar.y" { yyval.expr = exprNode_fromIdentifier (coerceId (yyvsp[0].cname)); ; break;} case 180: -#line 784 "cgrammar.y" +#line 786 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 182: -#line 788 "cgrammar.y" +#line 790 "cgrammar.y" { yyval.expr = exprNode_arrayFetch (yyvsp[-3].expr, yyvsp[-1].expr); ; break;} case 183: -#line 789 "cgrammar.y" +#line 791 "cgrammar.y" { yyval.expr = exprNode_functionCall (yyvsp[-2].expr, exprNodeList_new ()); ; break;} case 184: -#line 790 "cgrammar.y" +#line 792 "cgrammar.y" { yyval.expr = exprNode_functionCall (yyvsp[-3].expr, yyvsp[-1].alist); ; break;} case 185: -#line 791 "cgrammar.y" +#line 793 "cgrammar.y" { yyval.expr = exprNode_vaArg (yyvsp[-5].tok, yyvsp[-3].expr, yyvsp[-1].qtyp); ; break;} case 186: -#line 792 "cgrammar.y" +#line 794 "cgrammar.y" { yyval.expr = exprNode_fieldAccess (yyvsp[-4].expr, yyvsp[-1].cname); ; break;} case 187: -#line 793 "cgrammar.y" +#line 795 "cgrammar.y" { yyval.expr = exprNode_arrowAccess (yyvsp[-4].expr, yyvsp[-1].cname); ; break;} case 188: -#line 794 "cgrammar.y" +#line 796 "cgrammar.y" { yyval.expr = exprNode_postOp (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 189: -#line 795 "cgrammar.y" +#line 797 "cgrammar.y" { yyval.expr = exprNode_postOp (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 190: -#line 798 "cgrammar.y" +#line 800 "cgrammar.y" { yyval.alist = exprNodeList_singleton (yyvsp[0].expr); ; break;} case 191: -#line 799 "cgrammar.y" +#line 801 "cgrammar.y" { yyval.alist = exprNodeList_push (yyvsp[-2].alist, yyvsp[0].expr); ; break;} case 193: -#line 803 "cgrammar.y" +#line 805 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 194: -#line 804 "cgrammar.y" +#line 806 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 195: -#line 805 "cgrammar.y" +#line 807 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 196: -#line 806 "cgrammar.y" +#line 808 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 197: -#line 807 "cgrammar.y" +#line 809 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 198: -#line 808 "cgrammar.y" +#line 810 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 199: -#line 809 "cgrammar.y" +#line 811 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 200: -#line 810 "cgrammar.y" +#line 812 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 201: -#line 811 "cgrammar.y" +#line 813 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 202: -#line 812 "cgrammar.y" +#line 814 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 203: -#line 815 "cgrammar.y" +#line 817 "cgrammar.y" { yyval.cstringlist = cstringList_add (yyvsp[-2].cstringlist, yyvsp[0].cname); ; break;} case 204: -#line 816 "cgrammar.y" +#line 818 "cgrammar.y" { yyval.cstringlist = cstringList_single (yyvsp[0].cname); ; break;} case 205: -#line 820 "cgrammar.y" +#line 822 "cgrammar.y" { yyval.expr = exprNode_offsetof (yyvsp[-5].qtyp, yyvsp[-2].cstringlist); ; break;} case 206: -#line 823 "cgrammar.y" +#line 825 "cgrammar.y" { context_setProtectVars (); ; break;} case 207: -#line 824 "cgrammar.y" +#line 826 "cgrammar.y" { context_sizeofReleaseVars (); yyval.expr = yyvsp[0].expr; ; break;} case 208: -#line 827 "cgrammar.y" +#line 829 "cgrammar.y" { yyval.expr = exprNode_sizeofType (yyvsp[-1].qtyp); ; break;} case 209: -#line 828 "cgrammar.y" +#line 830 "cgrammar.y" { yyval.expr = exprNode_sizeofExpr (yyvsp[0].expr); ; break;} case 210: -#line 829 "cgrammar.y" +#line 831 "cgrammar.y" { yyval.expr = exprNode_alignofType (yyvsp[-1].qtyp); ; break;} case 211: -#line 830 "cgrammar.y" +#line 832 "cgrammar.y" { yyval.expr = exprNode_alignofExpr (yyvsp[0].expr); ; break;} case 213: -#line 835 "cgrammar.y" +#line 837 "cgrammar.y" { yyval.expr = exprNode_cast (yyvsp[-3].tok, yyvsp[0].expr, yyvsp[-2].qtyp); ; break;} case 215: -#line 839 "cgrammar.y" +#line 841 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 216: -#line 840 "cgrammar.y" +#line 842 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 217: -#line 841 "cgrammar.y" +#line 843 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 219: -#line 845 "cgrammar.y" +#line 847 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 220: -#line 846 "cgrammar.y" +#line 848 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 222: -#line 850 "cgrammar.y" +#line 852 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 223: -#line 851 "cgrammar.y" +#line 853 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 225: -#line 855 "cgrammar.y" +#line 857 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 226: -#line 856 "cgrammar.y" +#line 858 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 227: -#line 857 "cgrammar.y" +#line 859 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 228: -#line 858 "cgrammar.y" +#line 860 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 230: -#line 862 "cgrammar.y" +#line 864 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 231: -#line 863 "cgrammar.y" +#line 865 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 233: -#line 867 "cgrammar.y" +#line 869 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 235: -#line 871 "cgrammar.y" +#line 873 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 237: -#line 876 "cgrammar.y" +#line 878 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 239: -#line 881 "cgrammar.y" +#line 883 "cgrammar.y" { exprNode_produceGuards (yyvsp[-1].expr); context_enterAndClause (yyvsp[-1].expr); ; break;} case 240: -#line 885 "cgrammar.y" +#line 887 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-3].expr, yyvsp[0].expr, yyvsp[-2].tok); context_exitAndClause (yyval.expr, yyvsp[0].expr); ; break;} case 242: -#line 893 "cgrammar.y" +#line 895 "cgrammar.y" { exprNode_produceGuards (yyvsp[-1].expr); context_enterOrClause (yyvsp[-1].expr); ; break;} case 243: -#line 898 "cgrammar.y" +#line 900 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-3].expr, yyvsp[0].expr, yyvsp[-2].tok); context_exitOrClause (yyval.expr, yyvsp[0].expr); ; break;} case 245: -#line 905 "cgrammar.y" +#line 907 "cgrammar.y" { exprNode_produceGuards (yyvsp[-1].expr); context_enterTrueClause (yyvsp[-1].expr); ; break;} case 246: -#line 906 "cgrammar.y" +#line 908 "cgrammar.y" { context_enterFalseClause (yyvsp[-4].expr); ; break;} case 247: -#line 907 "cgrammar.y" +#line 909 "cgrammar.y" { yyval.expr = exprNode_cond (yyvsp[-6].expr, yyvsp[-3].expr, yyvsp[0].expr); context_exitClause (yyvsp[-6].expr, yyvsp[-3].expr, yyvsp[0].expr); ; break;} case 249: -#line 911 "cgrammar.y" +#line 913 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 250: -#line 912 "cgrammar.y" +#line 914 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 251: -#line 913 "cgrammar.y" +#line 915 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 252: -#line 914 "cgrammar.y" +#line 916 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 253: -#line 915 "cgrammar.y" +#line 917 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 254: -#line 916 "cgrammar.y" +#line 918 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 255: -#line 917 "cgrammar.y" +#line 919 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 256: -#line 918 "cgrammar.y" +#line 920 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 257: -#line 919 "cgrammar.y" +#line 921 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 258: -#line 920 "cgrammar.y" +#line 922 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 259: -#line 921 "cgrammar.y" +#line 923 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 261: -#line 925 "cgrammar.y" +#line 927 "cgrammar.y" { yyval.expr = exprNode_comma (yyvsp[-2].expr, yyvsp[0].expr); ; break;} case 262: -#line 928 "cgrammar.y" +#line 930 "cgrammar.y" { yyval.expr = exprNode_undefined; ; break;} case 265: -#line 937 "cgrammar.y" +#line 939 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 266: -#line 938 "cgrammar.y" +#line 940 "cgrammar.y" { doVaDcl (); yyval.expr = exprNode_makeError (); ; break;} case 267: -#line 939 "cgrammar.y" +#line 941 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 268: -#line 942 "cgrammar.y" +#line 944 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 269: -#line 956 "cgrammar.y" +#line 958 "cgrammar.y" { setProcessingVars (yyvsp[-3].qtyp); processNamedDecl (yyvsp[-1].ntyp); ; break;} case 270: -#line 959 "cgrammar.y" +#line 961 "cgrammar.y" { unsetProcessingVars (); yyval.expr = yyvsp[-2].expr; ; break;} case 271: -#line 961 "cgrammar.y" +#line 963 "cgrammar.y" { setProcessingVars (yyvsp[-4].qtyp); processNamedDecl (yyvsp[-2].ntyp); ; break;} case 272: -#line 964 "cgrammar.y" +#line 966 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-2].expr, exprNode_makeInitialization (yyvsp[-8].ntyp, yyvsp[-3].expr)); unsetProcessingVars (); ; break;} case 273: -#line 968 "cgrammar.y" +#line 970 "cgrammar.y" { processNamedDecl (yyvsp[-1].ntyp); yyval.expr = exprNode_makeError (); ; break;} case 274: -#line 969 "cgrammar.y" +#line 971 "cgrammar.y" { processNamedDecl (yyvsp[-2].ntyp); ; break;} case 275: -#line 970 "cgrammar.y" +#line 972 "cgrammar.y" { yyval.expr = exprNode_makeInitialization (yyvsp[-5].ntyp, yyvsp[0].expr); ; break;} case 276: -#line 974 "cgrammar.y" +#line 976 "cgrammar.y" { setProcessingTypedef (yyvsp[0].qtyp); ; break;} case 277: -#line 975 "cgrammar.y" +#line 977 "cgrammar.y" { unsetProcessingTypedef (); ; break;} case 278: -#line 976 "cgrammar.y" +#line 978 "cgrammar.y" { /* in the ANSI grammar, semantics unclear */ ; break;} case 279: -#line 977 "cgrammar.y" +#line 979 "cgrammar.y" { /* in the ANSI grammar, semantics unclear */ ; break;} case 280: -#line 980 "cgrammar.y" +#line 982 "cgrammar.y" { g_expectingTypeName = TRUE; ; break;} case 281: -#line 983 "cgrammar.y" +#line 985 "cgrammar.y" { g_expectingTypeName = TRUE; context_pushLoc (); ; break;} case 282: -#line 986 "cgrammar.y" +#line 988 "cgrammar.y" { ; ; break;} case 283: -#line 989 "cgrammar.y" +#line 991 "cgrammar.y" { ; ; break;} case 284: -#line 990 "cgrammar.y" +#line 992 "cgrammar.y" { ; ; break;} case 285: -#line 993 "cgrammar.y" +#line 995 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 286: -#line 994 "cgrammar.y" +#line 996 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-3].expr, yyvsp[0].expr); ; break;} case 287: -#line 997 "cgrammar.y" +#line 999 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 288: -#line 998 "cgrammar.y" +#line 1000 "cgrammar.y" { yyval.expr = exprNode_makeInitBlock (yyvsp[-2].tok, yyvsp[-1].alist); ; break;} case 289: -#line 999 "cgrammar.y" +#line 1001 "cgrammar.y" { yyval.expr = exprNode_makeInitBlock (yyvsp[-3].tok, yyvsp[-2].alist); ; break;} case 290: -#line 1004 "cgrammar.y" +#line 1006 "cgrammar.y" { yyval.alist = exprNodeList_singleton (yyvsp[0].expr); ; break;} case 291: -#line 1006 "cgrammar.y" +#line 1008 "cgrammar.y" { yyval.alist = exprNodeList_push (yyvsp[-2].alist, yyvsp[0].expr); ; break;} case 292: -#line 1014 "cgrammar.y" +#line 1016 "cgrammar.y" { setStorageClass (SCEXTERN); yyval.typequal = qual_createExtern (); ; break;} case 293: -#line 1015 "cgrammar.y" +#line 1017 "cgrammar.y" { yyval.typequal = qual_createInline (); ; break;} case 294: -#line 1016 "cgrammar.y" +#line 1018 "cgrammar.y" { setStorageClass (SCSTATIC); yyval.typequal = qual_createStatic (); ; break;} case 295: -#line 1017 "cgrammar.y" +#line 1019 "cgrammar.y" { yyval.typequal = qual_createAuto (); ; break;} case 296: -#line 1018 "cgrammar.y" +#line 1020 "cgrammar.y" { yyval.typequal = qual_createRegister (); ; break;} case 297: -#line 1021 "cgrammar.y" +#line 1023 "cgrammar.y" { yyval.typequal = qual_createConst (); ; break;} case 298: -#line 1022 "cgrammar.y" +#line 1024 "cgrammar.y" { yyval.typequal = qual_createVolatile (); ; break;} case 299: -#line 1023 "cgrammar.y" +#line 1025 "cgrammar.y" { yyval.typequal = qual_createOut (); ; break;} case 300: -#line 1024 "cgrammar.y" +#line 1026 "cgrammar.y" { yyval.typequal = qual_createIn (); ; break;} case 301: -#line 1025 "cgrammar.y" +#line 1027 "cgrammar.y" { yyval.typequal = qual_createPartial (); ; break;} case 302: -#line 1026 "cgrammar.y" +#line 1028 "cgrammar.y" { yyval.typequal = qual_createSpecial (); ; break;} case 303: -#line 1027 "cgrammar.y" +#line 1029 "cgrammar.y" { yyval.typequal = qual_createOwned (); ; break;} case 304: -#line 1028 "cgrammar.y" +#line 1030 "cgrammar.y" { yyval.typequal = qual_createDependent (); ; break;} case 305: -#line 1029 "cgrammar.y" +#line 1031 "cgrammar.y" { yyval.typequal = qual_createYield (); ; break;} case 306: -#line 1030 "cgrammar.y" +#line 1032 "cgrammar.y" { yyval.typequal = qual_createTemp (); ; break;} case 307: -#line 1031 "cgrammar.y" +#line 1033 "cgrammar.y" { yyval.typequal = qual_createOnly (); ; break;} case 308: -#line 1032 "cgrammar.y" +#line 1034 "cgrammar.y" { yyval.typequal = qual_createKeep (); ; break;} case 309: -#line 1033 "cgrammar.y" +#line 1035 "cgrammar.y" { yyval.typequal = qual_createKept (); ; break;} case 310: -#line 1034 "cgrammar.y" +#line 1036 "cgrammar.y" { yyval.typequal = qual_createShared (); ; break;} case 311: -#line 1035 "cgrammar.y" +#line 1037 "cgrammar.y" { yyval.typequal = qual_createUnique (); ; break;} case 312: -#line 1036 "cgrammar.y" +#line 1038 "cgrammar.y" { yyval.typequal = qual_createExits (); ; break;} case 313: -#line 1037 "cgrammar.y" +#line 1039 "cgrammar.y" { yyval.typequal = qual_createMayExit (); ; break;} case 314: -#line 1038 "cgrammar.y" +#line 1040 "cgrammar.y" { yyval.typequal = qual_createTrueExit (); ; break;} case 315: -#line 1039 "cgrammar.y" +#line 1041 "cgrammar.y" { yyval.typequal = qual_createFalseExit (); ; break;} case 316: -#line 1040 "cgrammar.y" +#line 1042 "cgrammar.y" { yyval.typequal = qual_createNeverExit (); ; break;} case 317: -#line 1041 "cgrammar.y" +#line 1043 "cgrammar.y" { yyval.typequal = qual_createNull (); ; break;} case 318: -#line 1042 "cgrammar.y" +#line 1044 "cgrammar.y" { yyval.typequal = qual_createRelNull (); ; break;} case 319: -#line 1043 "cgrammar.y" +#line 1045 "cgrammar.y" { yyval.typequal = qual_createReturned (); ; break;} case 320: -#line 1044 "cgrammar.y" +#line 1046 "cgrammar.y" { yyval.typequal = qual_createExposed (); ; break;} case 321: -#line 1045 "cgrammar.y" +#line 1047 "cgrammar.y" { yyval.typequal = qual_createObserver (); ; break;} case 322: -#line 1046 "cgrammar.y" +#line 1048 "cgrammar.y" { yyval.typequal = qual_createChecked (); ; break;} case 323: -#line 1047 "cgrammar.y" +#line 1049 "cgrammar.y" { yyval.typequal = qual_createCheckMod (); ; break;} case 324: -#line 1048 "cgrammar.y" +#line 1050 "cgrammar.y" { yyval.typequal = qual_createUnchecked (); ; break;} case 325: -#line 1049 "cgrammar.y" +#line 1051 "cgrammar.y" { yyval.typequal = qual_createCheckedStrict (); ; break;} case 326: -#line 1050 "cgrammar.y" +#line 1052 "cgrammar.y" { yyval.typequal = qual_createTrueNull (); ; break;} case 327: -#line 1051 "cgrammar.y" +#line 1053 "cgrammar.y" { yyval.typequal = qual_createFalseNull (); ; break;} case 328: -#line 1052 "cgrammar.y" +#line 1054 "cgrammar.y" { yyval.typequal = qual_createUnused (); ; break;} case 329: -#line 1053 "cgrammar.y" +#line 1055 "cgrammar.y" { yyval.typequal = qual_createExternal (); ; break;} case 330: -#line 1054 "cgrammar.y" +#line 1056 "cgrammar.y" { yyval.typequal = qual_createSef (); ; break;} case 331: -#line 1055 "cgrammar.y" +#line 1057 "cgrammar.y" { yyval.typequal = qual_createAbstract (); ; break;} case 332: -#line 1056 "cgrammar.y" +#line 1058 "cgrammar.y" { yyval.typequal = qual_createConcrete (); ; break;} case 333: -#line 1057 "cgrammar.y" +#line 1059 "cgrammar.y" { yyval.typequal = qual_createMutable (); ; break;} case 334: -#line 1058 "cgrammar.y" +#line 1060 "cgrammar.y" { yyval.typequal = qual_createImmutable (); ; break;} case 335: -#line 1059 "cgrammar.y" +#line 1061 "cgrammar.y" { yyval.typequal = qual_createNotNull (); ; break;} case 336: -#line 1060 "cgrammar.y" +#line 1062 "cgrammar.y" { yyval.typequal = qual_createRefCounted (); ; break;} case 337: -#line 1061 "cgrammar.y" +#line 1063 "cgrammar.y" { yyval.typequal = qual_createRefs (); ; break;} case 338: -#line 1062 "cgrammar.y" +#line 1064 "cgrammar.y" { yyval.typequal = qual_createKillRef (); ; break;} case 339: -#line 1063 "cgrammar.y" +#line 1065 "cgrammar.y" { yyval.typequal = qual_createRelDef (); ; break;} case 340: -#line 1064 "cgrammar.y" +#line 1066 "cgrammar.y" { yyval.typequal = qual_createNewRef (); ; break;} case 341: -#line 1065 "cgrammar.y" +#line 1067 "cgrammar.y" { yyval.typequal = qual_createTempRef (); ; break;} case 342: -#line 1066 "cgrammar.y" +#line 1068 "cgrammar.y" { yyval.typequal = qual_createNullTerminated (); ; break;} case 343: -#line 1072 "cgrammar.y" +#line 1074 "cgrammar.y" { yyval.typequal = qual_createShort (); ; break;} case 344: -#line 1073 "cgrammar.y" +#line 1075 "cgrammar.y" { yyval.typequal = qual_createLong (); ; break;} case 345: -#line 1074 "cgrammar.y" +#line 1076 "cgrammar.y" { yyval.typequal = qual_createSigned (); ; break;} case 346: -#line 1075 "cgrammar.y" +#line 1077 "cgrammar.y" { yyval.typequal = qual_createUnsigned (); ; break;} case 353: -#line 1084 "cgrammar.y" +#line 1086 "cgrammar.y" { yyval.ctyp = ctype_unknown; ; break;} case 354: -#line 1085 "cgrammar.y" +#line 1087 "cgrammar.y" { yyval.ctyp = ctype_anyintegral; ; break;} case 355: -#line 1086 "cgrammar.y" +#line 1088 "cgrammar.y" { yyval.ctyp = ctype_unsignedintegral; ; break;} case 356: -#line 1087 "cgrammar.y" +#line 1089 "cgrammar.y" { yyval.ctyp = ctype_signedintegral; ; break;} case 360: -#line 1091 "cgrammar.y" +#line 1093 "cgrammar.y" { yyval.ctyp = ctype_fromQual (yyvsp[-1].typequal); ; break;} case 361: -#line 1095 "cgrammar.y" +#line 1097 "cgrammar.y" { yyval.qtyp = qtype_resolve (yyvsp[-1].qtyp); ; break;} case 362: -#line 1098 "cgrammar.y" +#line 1100 "cgrammar.y" { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 363: -#line 1100 "cgrammar.y" +#line 1102 "cgrammar.y" { yyval.qtyp = qtype_mergeAlt (yyvsp[-3].qtyp, yyvsp[-1].qtyp); ; break;} case 365: -#line 1105 "cgrammar.y" +#line 1107 "cgrammar.y" { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ; break;} case 366: -#line 1108 "cgrammar.y" +#line 1110 "cgrammar.y" { yyval.qtyp = qtype_addQual (yyvsp[0].qtyp, yyvsp[-1].typequal); ; break;} case 367: -#line 1109 "cgrammar.y" +#line 1111 "cgrammar.y" { yyval.qtyp = qtype_addQual (yyvsp[0].qtyp, yyvsp[-1].typequal); ; break;} case 368: -#line 1110 "cgrammar.y" +#line 1112 "cgrammar.y" { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ; break;} case 369: -#line 1113 "cgrammar.y" +#line 1115 "cgrammar.y" { yyval.qtyp = qtype_unknown (); ; break;} case 370: -#line 1114 "cgrammar.y" +#line 1116 "cgrammar.y" { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 371: -#line 1117 "cgrammar.y" +#line 1119 "cgrammar.y" { sRef_setGlobalScopeSafe (); ; break;} case 372: -#line 1119 "cgrammar.y" +#line 1121 "cgrammar.y" { sRef_clearGlobalScopeSafe (); ; break;} case 373: -#line 1121 "cgrammar.y" +#line 1123 "cgrammar.y" { yyval.ctyp = declareStruct (yyvsp[-8].cname, yyvsp[-3].flist); ; break;} case 374: -#line 1122 "cgrammar.y" +#line 1124 "cgrammar.y" { sRef_setGlobalScopeSafe (); ; break;} case 375: -#line 1124 "cgrammar.y" +#line 1126 "cgrammar.y" { sRef_clearGlobalScopeSafe (); ; break;} case 376: -#line 1126 "cgrammar.y" +#line 1128 "cgrammar.y" { yyval.ctyp = declareUnion (yyvsp[-8].cname, yyvsp[-3].flist); ; break;} case 377: -#line 1128 "cgrammar.y" +#line 1130 "cgrammar.y" { yyval.ctyp = declareStruct (yyvsp[-3].cname, uentryList_new ()); ; break;} case 378: -#line 1130 "cgrammar.y" +#line 1132 "cgrammar.y" { yyval.ctyp = declareUnion (yyvsp[-3].cname, uentryList_new ()); ; break;} case 379: -#line 1131 "cgrammar.y" +#line 1133 "cgrammar.y" { sRef_setGlobalScopeSafe (); ; break;} case 380: -#line 1133 "cgrammar.y" +#line 1135 "cgrammar.y" { sRef_clearGlobalScopeSafe (); ; break;} case 381: -#line 1135 "cgrammar.y" +#line 1137 "cgrammar.y" { yyval.ctyp = declareUnnamedStruct (yyvsp[-3].flist); ; break;} case 382: -#line 1136 "cgrammar.y" +#line 1138 "cgrammar.y" { sRef_setGlobalScopeSafe (); ; break;} case 383: -#line 1138 "cgrammar.y" +#line 1140 "cgrammar.y" { sRef_clearGlobalScopeSafe (); ; break;} case 384: -#line 1140 "cgrammar.y" +#line 1142 "cgrammar.y" { yyval.ctyp = declareUnnamedUnion (yyvsp[-3].flist); ; break;} case 385: -#line 1142 "cgrammar.y" +#line 1144 "cgrammar.y" { yyval.ctyp = ctype_createUnnamedStruct (uentryList_new ()); ; break;} case 386: -#line 1144 "cgrammar.y" +#line 1146 "cgrammar.y" { yyval.ctyp = ctype_createUnnamedUnion (uentryList_new ()); ; break;} case 387: -#line 1145 "cgrammar.y" +#line 1147 "cgrammar.y" { yyval.ctyp = handleStruct (yyvsp[-1].cname); ; break;} case 388: -#line 1146 "cgrammar.y" +#line 1148 "cgrammar.y" { yyval.ctyp = handleUnion (yyvsp[-1].cname); ; break;} case 389: -#line 1149 "cgrammar.y" +#line 1151 "cgrammar.y" { g_expectingTypeName = FALSE; ; break;} case 391: -#line 1153 "cgrammar.y" +#line 1155 "cgrammar.y" { yyval.flist = uentryList_undefined; /* bogus! */ ; break;} case 392: -#line 1154 "cgrammar.y" +#line 1156 "cgrammar.y" { yyval.flist = uentryList_mergeFields (yyvsp[-1].flist, yyvsp[0].flist); ; break;} case 393: -#line 1158 "cgrammar.y" +#line 1160 "cgrammar.y" { yyval.flist = fixUentryList (yyvsp[-2].ntyplist, yyvsp[-4].qtyp); ; break;} case 394: -#line 1160 "cgrammar.y" +#line 1162 "cgrammar.y" { yyval.flist = fixUnnamedDecl (yyvsp[-2].qtyp); ; break;} case 395: -#line 1164 "cgrammar.y" +#line 1166 "cgrammar.y" { yyval.ntyplist = idDeclList_singleton (yyvsp[-1].ntyp); ; break;} case 396: -#line 1166 "cgrammar.y" +#line 1168 "cgrammar.y" { yyval.ntyplist = idDeclList_add (yyvsp[-3].ntyplist, yyvsp[-1].ntyp); ; break;} case 397: -#line 1169 "cgrammar.y" +#line 1171 "cgrammar.y" { yyval.ntyp = yyvsp[0].ntyp; ; break;} case 398: -#line 1170 "cgrammar.y" +#line 1172 "cgrammar.y" { yyval.ntyp = idDecl_undefined; ; break;} case 399: -#line 1171 "cgrammar.y" +#line 1173 "cgrammar.y" { yyval.ntyp = yyvsp[-3].ntyp; ; break;} case 400: -#line 1176 "cgrammar.y" +#line 1178 "cgrammar.y" { yyval.ctyp = declareUnnamedEnum (yyvsp[-2].enumnamelist); ; break;} case 401: -#line 1177 "cgrammar.y" +#line 1179 "cgrammar.y" { context_pushLoc (); ; break;} case 402: -#line 1178 "cgrammar.y" +#line 1180 "cgrammar.y" { context_popLoc (); yyval.ctyp = declareEnum (yyvsp[-5].cname, yyvsp[-2].enumnamelist); ; break;} case 403: -#line 1179 "cgrammar.y" +#line 1181 "cgrammar.y" { yyval.ctyp = handleEnum (yyvsp[-1].cname); ; break;} case 404: -#line 1183 "cgrammar.y" +#line 1185 "cgrammar.y" { yyval.enumnamelist = enumNameList_single (yyvsp[0].cname); ; break;} case 405: -#line 1185 "cgrammar.y" +#line 1187 "cgrammar.y" { yyval.enumnamelist = enumNameList_push (yyvsp[-2].enumnamelist, yyvsp[0].cname); ; break;} case 407: -#line 1190 "cgrammar.y" +#line 1192 "cgrammar.y" { uentry ue = uentry_makeEnumConstant (yyvsp[0].cname, ctype_unknown); usymtab_supGlobalEntry (ue); yyval.cname = yyvsp[0].cname; ; break;} case 408: -#line 1195 "cgrammar.y" +#line 1197 "cgrammar.y" { uentry ue = uentry_makeEnumInitializedConstant (yyvsp[-3].cname, ctype_unknown, yyvsp[0].expr); usymtab_supGlobalEntry (ue); yyval.cname = yyvsp[-3].cname; ; break;} case 410: -#line 1202 "cgrammar.y" +#line 1204 "cgrammar.y" { yyval.ntyp = idDecl_create (cstring_undefined, qtype_create (yyvsp[0].ctyp)); ; break;} case 411: -#line 1204 "cgrammar.y" +#line 1206 "cgrammar.y" { qtype qt = qtype_unknown (); @@ -4636,91 +4638,91 @@ case 411: ; break;} case 412: -#line 1211 "cgrammar.y" +#line 1213 "cgrammar.y" { yyval.ntyp = yyvsp[0].ntyp; qtype_adjustPointers (yyvsp[-1].count, idDecl_getTyp (yyval.ntyp)); ; break;} case 414: -#line 1216 "cgrammar.y" +#line 1218 "cgrammar.y" { yyval.ntyp = yyvsp[0].ntyp; qtype_adjustPointers (yyvsp[-1].count, idDecl_getTyp (yyval.ntyp)); ; break;} case 415: -#line 1219 "cgrammar.y" +#line 1221 "cgrammar.y" { yyval.entrylist = handleParamTypeList (yyvsp[0].entrylist); ; break;} case 416: -#line 1220 "cgrammar.y" +#line 1222 "cgrammar.y" { yyval.entrylist = handleParamIdList (yyvsp[0].entrylist); ; break;} case 417: -#line 1223 "cgrammar.y" +#line 1225 "cgrammar.y" { /* ignored for now */; ; break;} case 418: -#line 1224 "cgrammar.y" +#line 1226 "cgrammar.y" { ; ; break;} case 419: -#line 1227 "cgrammar.y" +#line 1229 "cgrammar.y" { ; ; break;} case 420: -#line 1228 "cgrammar.y" +#line 1230 "cgrammar.y" { ; ; break;} case 421: -#line 1231 "cgrammar.y" +#line 1233 "cgrammar.y" { yyval.count = 1; ; break;} case 422: -#line 1232 "cgrammar.y" +#line 1234 "cgrammar.y" { yyval.count = 1; ; break;} case 423: -#line 1233 "cgrammar.y" +#line 1235 "cgrammar.y" { yyval.count = 1 + yyvsp[0].count; ; break;} case 424: -#line 1234 "cgrammar.y" +#line 1236 "cgrammar.y" { yyval.count = 1 + yyvsp[0].count; ; break;} case 426: -#line 1238 "cgrammar.y" +#line 1240 "cgrammar.y" { yyval.entrylist = uentryList_add (yyvsp[-2].entrylist, uentry_makeElipsisMarker ()); ; break;} case 427: -#line 1241 "cgrammar.y" +#line 1243 "cgrammar.y" { yyval.entrylist = uentryList_single (uentry_makeVariableLoc (yyvsp[0].cname, ctype_int)); ; break;} case 428: -#line 1242 "cgrammar.y" +#line 1244 "cgrammar.y" { yyval.entrylist = uentryList_add (yyvsp[-2].entrylist, uentry_makeVariableLoc (yyvsp[0].cname, ctype_int)); ; break;} case 429: -#line 1245 "cgrammar.y" +#line 1247 "cgrammar.y" { yyval.entrylist = uentryList_single (uentry_makeElipsisMarker ()); ; break;} case 431: -#line 1247 "cgrammar.y" +#line 1249 "cgrammar.y" { yyval.entrylist = uentryList_add (yyvsp[-2].entrylist, uentry_makeElipsisMarker ()); ; break;} case 432: -#line 1250 "cgrammar.y" +#line 1252 "cgrammar.y" { storeLoc (); ; break;} case 433: -#line 1250 "cgrammar.y" +#line 1252 "cgrammar.y" { yyval.entrylist = uentryList_single (yyvsp[0].oentry); ; break;} case 434: -#line 1251 "cgrammar.y" +#line 1253 "cgrammar.y" { storeLoc (); ; break;} case 435: -#line 1252 "cgrammar.y" +#line 1254 "cgrammar.y" { yyval.entrylist = uentryList_add (yyvsp[-3].entrylist, yyvsp[0].oentry); ; break;} case 436: -#line 1256 "cgrammar.y" +#line 1258 "cgrammar.y" { if (isFlipOldStyle ()) { @@ -4734,7 +4736,7 @@ case 436: ; break;} case 437: -#line 1268 "cgrammar.y" +#line 1270 "cgrammar.y" { idDecl tparam = idDecl_create (yyvsp[0].cname, qtype_unknown ()); @@ -4750,385 +4752,385 @@ case 437: ; break;} case 439: -#line 1284 "cgrammar.y" +#line 1286 "cgrammar.y" { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ; break;} case 440: -#line 1287 "cgrammar.y" +#line 1289 "cgrammar.y" { yyval.ctyp = ctype_adjustPointers (yyvsp[0].count, ctype_unknown); ; break;} case 442: -#line 1289 "cgrammar.y" +#line 1291 "cgrammar.y" { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].count, yyvsp[0].ctyp); ; break;} case 443: -#line 1292 "cgrammar.y" +#line 1294 "cgrammar.y" { yyval.ctyp = ctype_unknown; ; break;} case 445: -#line 1297 "cgrammar.y" +#line 1299 "cgrammar.y" { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ; break;} case 446: -#line 1298 "cgrammar.y" +#line 1300 "cgrammar.y" { yyval.ctyp = ctype_makeArray (ctype_unknown); ; break;} case 447: -#line 1300 "cgrammar.y" +#line 1302 "cgrammar.y" { yyval.ctyp = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue (yyvsp[-1].expr)); ; break;} case 448: -#line 1301 "cgrammar.y" +#line 1303 "cgrammar.y" { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ; break;} case 449: -#line 1303 "cgrammar.y" +#line 1305 "cgrammar.y" { yyval.ctyp = ctype_makeFixedArray (yyvsp[-3].ctyp, exprNode_getLongValue (yyvsp[-1].expr)); ; break;} case 450: -#line 1305 "cgrammar.y" +#line 1307 "cgrammar.y" { yyval.ctyp = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); ; break;} case 451: -#line 1307 "cgrammar.y" +#line 1309 "cgrammar.y" { yyval.ctyp = ctype_makeParamsFunction (ctype_unknown, yyvsp[-1].entrylist); ; break;} case 452: -#line 1309 "cgrammar.y" +#line 1311 "cgrammar.y" { yyval.ctyp = ctype_makeFunction (yyvsp[-3].ctyp, uentryList_makeMissingParams ()); ; break;} case 453: -#line 1311 "cgrammar.y" +#line 1313 "cgrammar.y" { yyval.ctyp = ctype_makeParamsFunction (yyvsp[-4].ctyp, yyvsp[-1].entrylist); ; break;} case 463: -#line 1339 "cgrammar.y" +#line 1341 "cgrammar.y" { yyval.expr = exprNode_labelMarker (yyvsp[0].cname); ; break;} case 464: -#line 1344 "cgrammar.y" +#line 1346 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 467: -#line 1352 "cgrammar.y" +#line 1354 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 468: -#line 1356 "cgrammar.y" +#line 1358 "cgrammar.y" { yyval.expr = exprNode_while (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 469: -#line 1358 "cgrammar.y" +#line 1360 "cgrammar.y" { yyval.expr = exprNode_doWhile (yyvsp[-5].expr, yyvsp[-2].expr); ; break;} case 470: -#line 1360 "cgrammar.y" +#line 1362 "cgrammar.y" { yyval.expr = exprNode_doWhile (yyvsp[-4].expr, yyvsp[-1].expr); ; break;} case 471: -#line 1362 "cgrammar.y" +#line 1364 "cgrammar.y" { yyval.expr = exprNode_for (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 472: -#line 1366 "cgrammar.y" +#line 1368 "cgrammar.y" { context_setProtectVars (); ; break;} case 473: -#line 1366 "cgrammar.y" +#line 1368 "cgrammar.y" { context_sizeofReleaseVars (); ; break;} case 474: -#line 1368 "cgrammar.y" +#line 1370 "cgrammar.y" { yyval.expr = exprNode_forPred (yyvsp[-7].expr, yyvsp[-5].expr, yyvsp[-2].expr); context_enterForClause (yyvsp[-5].expr); ; break;} case 475: -#line 1373 "cgrammar.y" +#line 1375 "cgrammar.y" { setProcessingIterVars (yyvsp[-2].entry); ; break;} case 476: -#line 1375 "cgrammar.y" +#line 1377 "cgrammar.y" { yyval.expr = exprNode_iterStart (yyvsp[-5].entry, yyvsp[-1].alist); ; break;} case 477: -#line 1376 "cgrammar.y" +#line 1378 "cgrammar.y" { yyval.expr = exprNode_createId (yyvsp[0].entry); ; break;} case 481: -#line 1382 "cgrammar.y" +#line 1384 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 489: -#line 1390 "cgrammar.y" +#line 1392 "cgrammar.y" { yyval.expr = yyvsp[-1].expr; ; break;} case 490: -#line 1391 "cgrammar.y" +#line 1393 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 491: -#line 1395 "cgrammar.y" +#line 1397 "cgrammar.y" { /* don't: context_exitTrueClause ($1, $2); */ yyval.expr = exprNode_if (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 492: -#line 1400 "cgrammar.y" +#line 1402 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 493: -#line 1403 "cgrammar.y" +#line 1405 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 504: -#line 1418 "cgrammar.y" +#line 1420 "cgrammar.y" { yyval.expr = exprNode_addParens (yyvsp[-2].tok, yyvsp[-1].expr); ; break;} case 506: -#line 1420 "cgrammar.y" +#line 1422 "cgrammar.y" { yyval.expr = exprNode_makeError (); ; break;} case 507: -#line 1423 "cgrammar.y" +#line 1425 "cgrammar.y" { yyval.expr = exprNode_labelMarker (yyvsp[-1].cname); ; break;} case 508: -#line 1424 "cgrammar.y" +#line 1426 "cgrammar.y" { yyval.expr = exprNode_notReached (yyvsp[0].expr); ; break;} case 509: -#line 1430 "cgrammar.y" +#line 1432 "cgrammar.y" { context_enterCaseClause (yyvsp[0].expr); ; break;} case 510: -#line 1431 "cgrammar.y" +#line 1433 "cgrammar.y" { yyval.expr = exprNode_caseMarker (yyvsp[-2].expr, FALSE); ; break;} case 511: -#line 1432 "cgrammar.y" +#line 1434 "cgrammar.y" { context_enterCaseClause (yyvsp[0].expr); ; break;} case 512: -#line 1433 "cgrammar.y" +#line 1435 "cgrammar.y" { yyval.expr = exprNode_caseMarker (yyvsp[-2].expr, TRUE); ; break;} case 513: -#line 1436 "cgrammar.y" +#line 1438 "cgrammar.y" { context_enterCaseClause (exprNode_undefined); ; break;} case 514: -#line 1437 "cgrammar.y" +#line 1439 "cgrammar.y" { yyval.expr = exprNode_defaultMarker (yyvsp[-2].tok, FALSE); ; break;} case 515: -#line 1438 "cgrammar.y" +#line 1440 "cgrammar.y" { context_enterCaseClause (exprNode_undefined); ; break;} case 516: -#line 1439 "cgrammar.y" +#line 1441 "cgrammar.y" { yyval.expr = exprNode_defaultMarker (yyvsp[-2].tok, TRUE); ; break;} case 517: -#line 1442 "cgrammar.y" +#line 1444 "cgrammar.y" { yyval.expr = yyvsp[-1].expr; ; break;} case 518: -#line 1444 "cgrammar.y" +#line 1446 "cgrammar.y" { yyval.expr = yyvsp[0].expr; context_exitInner (yyvsp[0].expr); ; break;} case 519: -#line 1447 "cgrammar.y" +#line 1449 "cgrammar.y" { yyval.expr = yyvsp[-1].expr; ; break;} case 520: -#line 1450 "cgrammar.y" +#line 1452 "cgrammar.y" { context_enterInnerContext (); ; break;} case 521: -#line 1453 "cgrammar.y" +#line 1455 "cgrammar.y" { context_exitInnerPlain (); ; break;} case 522: -#line 1456 "cgrammar.y" +#line 1458 "cgrammar.y" { context_enterStructInnerContext (); ; break;} case 523: -#line 1459 "cgrammar.y" +#line 1461 "cgrammar.y" { context_exitStructInnerContext (); ; break;} case 524: -#line 1462 "cgrammar.y" +#line 1464 "cgrammar.y" { context_exitInnerSafe (); ; break;} case 525: -#line 1465 "cgrammar.y" +#line 1467 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 526: -#line 1466 "cgrammar.y" +#line 1468 "cgrammar.y" { yyval.expr = exprNode_notReached (exprNode_createTok (yyvsp[0].tok)); ; break;} case 527: -#line 1467 "cgrammar.y" +#line 1469 "cgrammar.y" { yyval.expr = exprNode_updateLocation (yyvsp[-1].expr, lltok_getLoc (yyvsp[0].tok)); ; break;} case 528: -#line 1469 "cgrammar.y" +#line 1471 "cgrammar.y" { yyval.expr = exprNode_notReached (exprNode_updateLocation (yyvsp[-2].expr, lltok_getLoc (yyvsp[0].tok))); ; break;} case 529: -#line 1470 "cgrammar.y" +#line 1472 "cgrammar.y" { yyval.expr = exprNode_updateLocation (yyvsp[-1].expr, lltok_getLoc (yyvsp[0].tok)); ; break;} case 530: -#line 1472 "cgrammar.y" +#line 1474 "cgrammar.y" { yyval.expr = exprNode_notReached (exprNode_updateLocation (yyvsp[-2].expr, lltok_getLoc (yyvsp[0].tok))); ; break;} case 531: -#line 1474 "cgrammar.y" +#line 1476 "cgrammar.y" { yyval.expr = exprNode_updateLocation (exprNode_concat (yyvsp[-2].expr, yyvsp[-1].expr), lltok_getLoc (yyvsp[0].tok)); ; break;} case 532: -#line 1476 "cgrammar.y" +#line 1478 "cgrammar.y" { yyval.expr = exprNode_notReached (exprNode_updateLocation (exprNode_concat (yyvsp[-3].expr, yyvsp[-2].expr), lltok_getLoc (yyvsp[-1].tok))); ; break;} case 533: -#line 1483 "cgrammar.y" +#line 1485 "cgrammar.y" { yyval.expr = exprNode_makeBlock (yyvsp[0].expr); ; break;} case 534: -#line 1487 "cgrammar.y" +#line 1489 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 535: -#line 1489 "cgrammar.y" +#line 1491 "cgrammar.y" { yyval.expr = exprNode_updateLocation (yyvsp[-1].expr, lltok_getLoc (yyvsp[0].tok)); ; break;} case 536: -#line 1491 "cgrammar.y" +#line 1493 "cgrammar.y" { yyval.expr = exprNode_updateLocation (yyvsp[-1].expr, lltok_getLoc (yyvsp[0].tok)); ; break;} case 537: -#line 1493 "cgrammar.y" +#line 1495 "cgrammar.y" { yyval.expr = exprNode_updateLocation (exprNode_concat (yyvsp[-2].expr, yyvsp[-1].expr), lltok_getLoc (yyvsp[0].tok)); ; break;} case 539: -#line 1497 "cgrammar.y" +#line 1499 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 540: -#line 1500 "cgrammar.y" +#line 1502 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 541: -#line 1501 "cgrammar.y" +#line 1503 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 542: -#line 1504 "cgrammar.y" +#line 1506 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 543: -#line 1505 "cgrammar.y" +#line 1507 "cgrammar.y" { yyval.expr = exprNode_concat (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 544: -#line 1508 "cgrammar.y" +#line 1510 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 545: -#line 1509 "cgrammar.y" +#line 1511 "cgrammar.y" { yyval.expr = exprNode_statement (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 546: -#line 1512 "cgrammar.y" +#line 1514 "cgrammar.y" { yyval.expr = exprNode_createTok (yyvsp[0].tok); ; break;} case 547: -#line 1513 "cgrammar.y" +#line 1515 "cgrammar.y" { yyval.expr = exprNode_statement (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 548: -#line 1514 "cgrammar.y" +#line 1516 "cgrammar.y" { yyval.expr = exprNode_checkExpr (yyvsp[0].expr); ; break;} case 549: -#line 1518 "cgrammar.y" +#line 1520 "cgrammar.y" { yyval.expr = yyvsp[-1].expr; exprNode_produceGuards (yyvsp[-1].expr); context_enterTrueClause (yyvsp[-1].expr); ; break;} case 550: -#line 1526 "cgrammar.y" +#line 1528 "cgrammar.y" { context_exitTrueClause (yyvsp[-1].expr, yyvsp[0].expr); yyval.expr = exprNode_if (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 551: -#line 1530 "cgrammar.y" +#line 1532 "cgrammar.y" { context_enterFalseClause (yyvsp[-2].expr); ; break;} case 552: -#line 1531 "cgrammar.y" +#line 1533 "cgrammar.y" { context_exitClause (yyvsp[-4].expr, yyvsp[-3].expr, yyvsp[0].expr); yyval.expr = exprNode_ifelse (yyvsp[-4].expr, yyvsp[-3].expr, yyvsp[0].expr); ; break;} case 553: -#line 1535 "cgrammar.y" +#line 1537 "cgrammar.y" { context_enterSwitch (yyvsp[0].expr); ; break;} case 554: -#line 1536 "cgrammar.y" +#line 1538 "cgrammar.y" { yyval.expr = exprNode_switch (yyvsp[-3].expr, yyvsp[0].expr); ; break;} case 555: -#line 1540 "cgrammar.y" +#line 1542 "cgrammar.y" { yyval.expr = exprNode_whilePred (yyvsp[-1].expr); context_enterWhileClause (yyvsp[-1].expr); ; break;} case 556: -#line 1544 "cgrammar.y" +#line 1546 "cgrammar.y" { yyval.expr = exprNode_whilePred(yyvsp[-1].expr); ; break;} case 557: -#line 1547 "cgrammar.y" +#line 1549 "cgrammar.y" { context_enterIterClause (); ; break;} case 558: -#line 1548 "cgrammar.y" +#line 1550 "cgrammar.y" { setProcessingIterVars (yyvsp[-3].entry); ; break;} case 559: -#line 1551 "cgrammar.y" +#line 1553 "cgrammar.y" { yyval.expr = exprNode_iter (yyvsp[-9].entry, yyvsp[-4].alist, yyvsp[-2].expr, yyvsp[-1].entry); ; break;} case 560: -#line 1557 "cgrammar.y" +#line 1559 "cgrammar.y" { yyval.alist = exprNodeList_singleton (yyvsp[0].expr); ; break;} case 561: -#line 1558 "cgrammar.y" +#line 1560 "cgrammar.y" { nextIterParam (); ; break;} case 562: -#line 1559 "cgrammar.y" +#line 1561 "cgrammar.y" { yyval.alist = exprNodeList_push (yyvsp[-3].alist, yyvsp[0].expr); ; break;} case 563: -#line 1562 "cgrammar.y" +#line 1564 "cgrammar.y" { yyval.expr = exprNode_iterExpr (yyvsp[0].expr); ; break;} case 564: -#line 1563 "cgrammar.y" +#line 1565 "cgrammar.y" { yyval.expr = exprNode_iterId (yyvsp[0].entry); ; break;} case 565: -#line 1564 "cgrammar.y" +#line 1566 "cgrammar.y" { uentry ue = coerceIterId (yyvsp[0].cname); if (uentry_isValid (ue)) @@ -5142,320 +5144,320 @@ case 565: ; break;} case 566: -#line 1575 "cgrammar.y" +#line 1577 "cgrammar.y" { yyval.expr = exprNode_iterNewId (yyvsp[0].cname); ; break;} case 568: -#line 1583 "cgrammar.y" +#line 1585 "cgrammar.y" { yyval.expr = exprNode_addParens (yyvsp[-2].tok, yyvsp[-1].expr); ; break;} case 570: -#line 1587 "cgrammar.y" +#line 1589 "cgrammar.y" { yyval.expr = exprNode_arrayFetch (yyvsp[-3].expr, yyvsp[-1].expr); ; break;} case 571: -#line 1588 "cgrammar.y" +#line 1590 "cgrammar.y" { yyval.expr = exprNode_functionCall (yyvsp[-2].expr, exprNodeList_new ()); ; break;} case 572: -#line 1589 "cgrammar.y" +#line 1591 "cgrammar.y" { yyval.expr = exprNode_functionCall (yyvsp[-3].expr, yyvsp[-1].alist); ; break;} case 573: -#line 1591 "cgrammar.y" +#line 1593 "cgrammar.y" { yyval.expr = exprNode_vaArg (yyvsp[-5].tok, yyvsp[-3].expr, yyvsp[-1].qtyp); ; break;} case 574: -#line 1592 "cgrammar.y" +#line 1594 "cgrammar.y" { yyval.expr = exprNode_fieldAccess (yyvsp[-4].expr, yyvsp[-1].cname); ; break;} case 575: -#line 1593 "cgrammar.y" +#line 1595 "cgrammar.y" { yyval.expr = exprNode_arrowAccess (yyvsp[-4].expr, yyvsp[-1].cname); ; break;} case 576: -#line 1594 "cgrammar.y" +#line 1596 "cgrammar.y" { yyval.expr = exprNode_postOp (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 577: -#line 1595 "cgrammar.y" +#line 1597 "cgrammar.y" { yyval.expr = exprNode_postOp (yyvsp[-1].expr, yyvsp[0].tok); ; break;} case 579: -#line 1599 "cgrammar.y" +#line 1601 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 580: -#line 1600 "cgrammar.y" +#line 1602 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 581: -#line 1601 "cgrammar.y" +#line 1603 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 582: -#line 1602 "cgrammar.y" +#line 1604 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 583: -#line 1603 "cgrammar.y" +#line 1605 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 584: -#line 1604 "cgrammar.y" +#line 1606 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 585: -#line 1605 "cgrammar.y" +#line 1607 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 586: -#line 1606 "cgrammar.y" +#line 1608 "cgrammar.y" { yyval.expr = exprNode_preOp (yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 587: -#line 1607 "cgrammar.y" +#line 1609 "cgrammar.y" { yyval.expr = yyvsp[0].expr; ; break;} case 589: -#line 1611 "cgrammar.y" +#line 1613 "cgrammar.y" { yyval.expr = exprNode_cast (yyvsp[-3].tok, yyvsp[0].expr, yyvsp[-2].qtyp); ; break;} case 591: -#line 1615 "cgrammar.y" +#line 1617 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 592: -#line 1616 "cgrammar.y" +#line 1618 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 593: -#line 1617 "cgrammar.y" +#line 1619 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 595: -#line 1621 "cgrammar.y" +#line 1623 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 596: -#line 1622 "cgrammar.y" +#line 1624 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 598: -#line 1626 "cgrammar.y" +#line 1628 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 599: -#line 1627 "cgrammar.y" +#line 1629 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 601: -#line 1631 "cgrammar.y" +#line 1633 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 602: -#line 1632 "cgrammar.y" +#line 1634 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 603: -#line 1633 "cgrammar.y" +#line 1635 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 604: -#line 1634 "cgrammar.y" +#line 1636 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 606: -#line 1638 "cgrammar.y" +#line 1640 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 607: -#line 1639 "cgrammar.y" +#line 1641 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 609: -#line 1643 "cgrammar.y" +#line 1645 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 611: -#line 1647 "cgrammar.y" +#line 1649 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 613: -#line 1652 "cgrammar.y" +#line 1654 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 615: -#line 1656 "cgrammar.y" +#line 1658 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 617: -#line 1660 "cgrammar.y" +#line 1662 "cgrammar.y" { yyval.expr = exprNode_op (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 619: -#line 1664 "cgrammar.y" +#line 1666 "cgrammar.y" { context_enterTrueClause (yyvsp[-1].expr); ; break;} case 620: -#line 1665 "cgrammar.y" +#line 1667 "cgrammar.y" { context_enterFalseClause (yyvsp[-4].expr); ; break;} case 621: -#line 1666 "cgrammar.y" +#line 1668 "cgrammar.y" { yyval.expr = exprNode_cond (yyvsp[-6].expr, yyvsp[-3].expr, yyvsp[0].expr); ; break;} case 623: -#line 1670 "cgrammar.y" +#line 1672 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 624: -#line 1671 "cgrammar.y" +#line 1673 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 625: -#line 1672 "cgrammar.y" +#line 1674 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 626: -#line 1673 "cgrammar.y" +#line 1675 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 627: -#line 1674 "cgrammar.y" +#line 1676 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 628: -#line 1675 "cgrammar.y" +#line 1677 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 629: -#line 1676 "cgrammar.y" +#line 1678 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 630: -#line 1677 "cgrammar.y" +#line 1679 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 631: -#line 1678 "cgrammar.y" +#line 1680 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 632: -#line 1679 "cgrammar.y" +#line 1681 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 633: -#line 1680 "cgrammar.y" +#line 1682 "cgrammar.y" { yyval.expr = exprNode_assign (yyvsp[-2].expr, yyvsp[0].expr, yyvsp[-1].tok); ; break;} case 634: -#line 1683 "cgrammar.y" +#line 1685 "cgrammar.y" { yyval.entry = yyvsp[0].entry; ; break;} case 635: -#line 1684 "cgrammar.y" +#line 1686 "cgrammar.y" { yyval.entry = uentry_undefined; ; break;} case 636: -#line 1687 "cgrammar.y" +#line 1689 "cgrammar.y" { context_enterDoWhileClause (); yyval.tok = yyvsp[0].tok; ; break;} case 637: -#line 1691 "cgrammar.y" +#line 1693 "cgrammar.y" { yyval.expr = exprNode_while (yyvsp[-1].expr, yyvsp[0].expr); context_exitWhileClause (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 638: -#line 1693 "cgrammar.y" +#line 1695 "cgrammar.y" { yyval.expr = exprNode_statement (exprNode_doWhile (yyvsp[-5].expr, yyvsp[-2].expr), yyvsp[0].tok); ; break;} case 639: -#line 1695 "cgrammar.y" +#line 1697 "cgrammar.y" { yyval.expr = exprNode_for (yyvsp[-1].expr, yyvsp[0].expr); context_exitForClause (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 640: -#line 1698 "cgrammar.y" +#line 1700 "cgrammar.y" { yyval.expr = exprNode_while (yyvsp[-1].expr, yyvsp[0].expr); context_exitWhileClause (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 641: -#line 1700 "cgrammar.y" +#line 1702 "cgrammar.y" { yyval.expr = exprNode_statement (exprNode_doWhile (yyvsp[-5].expr, yyvsp[-2].expr), yyvsp[0].tok); ; break;} case 642: -#line 1702 "cgrammar.y" +#line 1704 "cgrammar.y" { yyval.expr = exprNode_doWhile (yyvsp[-4].expr, yyvsp[-1].expr); ; break;} case 643: -#line 1703 "cgrammar.y" +#line 1705 "cgrammar.y" { yyval.expr = exprNode_for (yyvsp[-1].expr, yyvsp[0].expr); context_exitForClause (yyvsp[-1].expr, yyvsp[0].expr); ; break;} case 644: -#line 1706 "cgrammar.y" +#line 1708 "cgrammar.y" { yyval.expr = exprNode_goto (yyvsp[-1].cname); ; break;} case 645: -#line 1707 "cgrammar.y" +#line 1709 "cgrammar.y" { yyval.expr = exprNode_continue (yyvsp[-1].tok, BADTOK); ; break;} case 646: -#line 1709 "cgrammar.y" +#line 1711 "cgrammar.y" { yyval.expr = exprNode_continue (yyvsp[-2].tok, QINNERCONTINUE); ; break;} case 647: -#line 1710 "cgrammar.y" +#line 1712 "cgrammar.y" { yyval.expr = exprNode_break (yyvsp[-1].tok, BADTOK); ; break;} case 648: -#line 1711 "cgrammar.y" +#line 1713 "cgrammar.y" { yyval.expr = exprNode_break (yyvsp[-1].tok, QSWITCHBREAK); ; break;} case 649: -#line 1712 "cgrammar.y" +#line 1714 "cgrammar.y" { yyval.expr = exprNode_break (yyvsp[-1].tok, QLOOPBREAK); ; break;} case 650: -#line 1713 "cgrammar.y" +#line 1715 "cgrammar.y" { yyval.expr = exprNode_break (yyvsp[-1].tok, QINNERBREAK); ; break;} case 651: -#line 1714 "cgrammar.y" +#line 1716 "cgrammar.y" { yyval.expr = exprNode_break (yyvsp[-1].tok, QSAFEBREAK); ; break;} case 652: -#line 1715 "cgrammar.y" +#line 1717 "cgrammar.y" { yyval.expr = exprNode_nullReturn (yyvsp[-1].tok); ; break;} case 653: -#line 1716 "cgrammar.y" +#line 1718 "cgrammar.y" { yyval.expr = exprNode_return (yyvsp[-1].expr); ; break;} case 655: -#line 1720 "cgrammar.y" +#line 1722 "cgrammar.y" { ; ; break;} case 658: -#line 1727 "cgrammar.y" +#line 1729 "cgrammar.y" { yyval.cname = uentry_getName (yyvsp[0].entry); ; break;} case 659: -#line 1728 "cgrammar.y" +#line 1730 "cgrammar.y" { yyval.cname = uentry_getName (yyvsp[0].entry); ; break;} case 660: -#line 1729 "cgrammar.y" +#line 1731 "cgrammar.y" { yyval.cname = uentry_getName (yyvsp[0].entry); ; break;} case 661: -#line 1730 "cgrammar.y" +#line 1732 "cgrammar.y" { yyval.cname = yyvsp[0].cname; ; break;} case 663: -#line 1734 "cgrammar.y" +#line 1736 "cgrammar.y" { yyval.ctyp = ctype_unknown; ; break;} } /* the action file gets copied in in place of this dollarsign */ -#line 498 "/gnu/share/bison.simple" +#line 498 "/usr/share/misc/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -5651,7 +5653,7 @@ yyerrhandle: yystate = yyn; goto yynewstate; } -#line 1736 "cgrammar.y" +#line 1738 "cgrammar.y" /*@-redecl@*/ diff --git a/src/cgrammar.y b/src/cgrammar.y index 6b1e4ff..6c057b1 100644 --- a/src/cgrammar.y +++ b/src/cgrammar.y @@ -330,10 +330,12 @@ namedDeclBase context_popLoc (); } | namedDeclBase PushType TLPAREN genericParamList TRPAREN - { setCurrentParams ($4); + { setCurrentParams ($4); + } optGlobMods optGlobBufConstraints - { clearCurrentParams (); + { setImplictfcnConstraints (); + clearCurrentParams (); $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4)); context_popLoc (); diff --git a/src/clabstract.c b/src/clabstract.c index af1d256..0586a4e 100644 --- a/src/clabstract.c +++ b/src/clabstract.c @@ -57,6 +57,10 @@ /*@only@*/ static constraintList fcnEnsuresConstraints = NULL; /*end drl*/ +/*drl */ +/*@only@*/ constraintList implicitFcnConstraints = NULL; + + //static constraintList fcnPreConditions = NULL; @@ -622,6 +626,43 @@ declareEnumList (enumNameList el, ctype c, fileloc loc) static /*@dependent@*/ uentryList currentParamList; +/*drl added 3-28-2001*/ +/* this function takes a list of paramentar and generates a list + of constraints. + Currently the only constraints gnerated are MaxSet(p) >= 0 for all pointers +*/ +void setImplictfcnConstraints () +{ + uentryList params; + sRef s; + constraint c; + params = currentParamList; + + implicitFcnConstraints = constraint_makeNew(); + + uentryList_elements (params, el) + { + DPRINTF((message("setImplictfcnConstraints doing: %s", uentry_unparse(el) ) )); + + s = uentry_getSref(el); + if (sRef_isReference (s) ) + { + DPRINTF((message ("%s is a pointer", sRef_unparse(s) ) )); + } + else + { + DPRINTF((message ("%s is NOT a pointer", sRef_unparse(s) ) )); + } + /*drl 4/26/01 + chagned this is MaxSet(s) == 0 to MaxSet(s) >= 0 */ + + c = constraint_makeSRefWriteSafeInt (s, 0); + // constraint_makeSRefSetBufferSize (s, 0); + implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c); + } + end_uentryList_elements; +} + void setCurrentParams (/*@dependent@*/ uentryList ue) { currentParamList = ue; diff --git a/src/constraint.c b/src/constraint.c index c7a8e16..2226654 100644 --- a/src/constraint.c +++ b/src/constraint.c @@ -307,6 +307,18 @@ constraint constraint_makeReadSafeInt ( exprNode po, int ind) return ret; } +constraint constraint_makeSRefReadSafeInt (sRef s, int ind) +{ + constraint ret = constraint_makeNew(); + + + ret->lexpr = constraintExpr_makeSRefMaxRead (s); + ret->ar = GTE; + ret->expr = constraintExpr_makeValueInt (ind); + ret->post = TRUE; + /*@i1*/return ret; +} + constraint constraint_makeEnsureMaxReadAtLeast (exprNode e1, exprNode t2, fileloc sequencePoint) { constraint ret = constraint_makeNew(); @@ -325,27 +337,47 @@ constraint constraint_makeEnsureMaxReadAtLeast (exprNode e1, exprNode t2, filelo return ret; } +static constraint constraint_makeEnsuresOpConstraintExpr (constraintExpr c1, constraintExpr c2, fileloc sequencePoint, arithType ar) +{ + + constraint ret; + + llassert(c1 && c2); + // llassert(sequencePoint); + + ret = constraint_makeNew(); + + ret->lexpr = c1; + ret->ar = ar; + ret->post = TRUE; + ret->expr = c2; + ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); + return ret; +} static constraint constraint_makeEnsuresOp (exprNode e1, exprNode e2, fileloc sequencePoint, arithType ar) { - constraint ret = constraint_makeNew(); + constraintExpr c1, c2; + constraint ret; exprNode e; - - e = exprNode_fakeCopy(e1); + if (! (e1 && e2) ) { llcontbug((message("null exprNode, Exprnodes are %s and %s", exprNode_unparse(e1), exprNode_unparse(e2) ) )); } - - ret->lexpr = constraintExpr_makeValueExpr (e); - ret->ar = ar; - ret->post = TRUE; - e = exprNode_fakeCopy(e2); - ret->expr = constraintExpr_makeValueExpr (e); + + // llassert (sequencePoint); + + e = exprNode_fakeCopy(e1); + c1 = constraintExpr_makeValueExpr (e); + + e = exprNode_fakeCopy(e2); + c2 = constraintExpr_makeValueExpr (e); + + ret = constraint_makeEnsuresOpConstraintExpr (c1, c2, sequencePoint, ar); - ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } @@ -360,7 +392,16 @@ constraint constraint_makeEnsureEqual (exprNode e1, exprNode e2, fileloc sequenc /*make constraint ensures e1 < e2 */ constraint constraint_makeEnsureLessThan (exprNode e1, exprNode e2, fileloc sequencePoint) { - return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, LT) ); + constraintExpr t1, t2; + + t1 = constraintExpr_makeValueExpr (e1); + t2 = constraintExpr_makeValueExpr (e2); + + /*change this to e1 <= (e2 -1) */ + + t2 = constraintExpr_makeDecConstraintExpr (t2); + + return ( constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, LTE) ); } constraint constraint_makeEnsureLessThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) @@ -370,7 +411,17 @@ constraint constraint_makeEnsureLessThanEqual (exprNode e1, exprNode e2, fileloc constraint constraint_makeEnsureGreaterThan (exprNode e1, exprNode e2, fileloc sequencePoint) { - return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, GT) ); + constraintExpr t1, t2; + + t1 = constraintExpr_makeValueExpr (e1); + t2 = constraintExpr_makeValueExpr (e2); + + + /* change this to e1 >= (e2 + 1) */ + t2 = constraintExpr_makeIncConstraintExpr (t2); + + + return ( constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, GTE) ); } constraint constraint_makeEnsureGreaterThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) diff --git a/src/constraintExpr.c b/src/constraintExpr.c index 9cceb0f..fea38c1 100644 --- a/src/constraintExpr.c +++ b/src/constraintExpr.c @@ -261,6 +261,13 @@ constraintExpr constraintExpr_makeExprNode (exprNode e) t = exprData_getUopNode (data); ret = constraintExpr_makeExprNode (t); break; + case XPR_CAST: + t = exprData_getCastNode (data); + ret = constraintExpr_makeExprNode (t); + break; + case XPR_COMMA: + t = exprData_getPairA(data); + ret = constraintExpr_makeExprNode(t); default: ret = oldconstraintExpr_makeTermExprNode (e); @@ -334,6 +341,11 @@ constraintExpr constraintExpr_makeSRefUnaryOp (sRef s, constraintExprUnaryOpKin return ret; } +constraintExpr constraintExpr_makeSRefMaxRead(sRef s) +{ + return (constraintExpr_makeSRefUnaryOp (s, MAXREAD) ); +} + constraintExpr constraintExpr_makeSRefMaxset (sRef s) { return (constraintExpr_makeSRefUnaryOp (s, MAXSET) ); @@ -696,7 +708,7 @@ constraintExpr constraintExpr_searchandreplace (constraintExpr c, constraintExpr if ( constraintExpr_similar (c, old) ) { #warning mem leak - BPRINTF((message ("Replacing %s with %s", + DPRINTF((message ("Replacing %s with %s", constraintExpr_unparse(old), constraintExpr_unparse(new) ))); return constraintExpr_copy (new); @@ -1149,7 +1161,7 @@ bool constraintExpr_hasMaxSet (constraintExpr expr) /*@*/ t = constraintExpr_unparse(expr); - return (strstr (t, "MAXSET") ); + return ((bool)strstr (t, "MAXSET") ); } diff --git a/src/constraintGeneration.c b/src/constraintGeneration.c index 1fb948f..2e460e4 100644 --- a/src/constraintGeneration.c +++ b/src/constraintGeneration.c @@ -18,6 +18,8 @@ # include "exprData.i" # include "exprDataQuite.i" +extern void forLoopHeuristics( exprNode e, exprNode forPred, exprNode forBody); + bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode e); static bool exprNode_handleError( exprNode p_e); @@ -246,8 +248,11 @@ bool exprNode_stmt (exprNode e) if (exprNode_isMultiStatement (snode)) { - // llassert(FALSE); - return exprNode_multiStatement (snode); + bool temp; + + temp = exprNode_multiStatement (snode); + exprNode_copyConstraints (e, snode); + return temp; } loc = exprNode_getNextSequencePoint(e); /* reduces to an expression */ @@ -303,26 +308,80 @@ bool exprNode_stmtList (exprNode e) return TRUE; } - exprNode doIf (exprNode e, exprNode test, exprNode body) { DPRINTF ((message ("doIf: %s ", exprNode_unparse(e) ) ) ); + + llassert(test); + llassert(e); + llassert(body); test->ensuresConstraints = exprNode_traversEnsuresConstraints (test); + test->requiresConstraints = exprNode_traversRequiresConstraints (test); + test->trueEnsuresConstraints = exprNode_traversTrueEnsuresConstraints(test); e->requiresConstraints = reflectChanges (body->requiresConstraints, test->trueEnsuresConstraints); e->requiresConstraints = reflectChanges (e->requiresConstraints, test->ensuresConstraints); - e->requiresConstraints = constraintList_addList(e->requiresConstraints, test->requiresConstraints); + e->requiresConstraints = constraintList_mergeRequires (e->requiresConstraints, test->requiresConstraints); + #warning bad e->ensuresConstraints = constraintList_copy (test->ensuresConstraints); - + /* + if (!exprNode_mayEscape (body) ) + e->ensuresConstraints = constraintList_mergeEnsures (e->ensuresConstraints, + test->falseEnsuresConstraints); + */ DPRINTF ((message ("doIf: if requiers %s ", constraintList_print(e->requiresConstraints) ) ) ); return e; } +/*drl added 3/4/2001 + Also used for condition i.e. ?: operation + + Precondition + This function assumes that p, trueBranch, falseBranch have have all been traversed + for constraints i.e. we assume that exprNode_traversEnsuresConstraints, + exprNode_traversRequiresConstraints, exprNode_traversTrueEnsuresConstraints, + exprNode_traversFalseEnsuresConstraints have all been run +*/ + + +exprNode doIfElse (/*@returned@*/ exprNode e, exprNode p, exprNode trueBranch, exprNode falseBranch) +{ + + constraintList c1, cons, t, f; + + // do requires clauses + c1 = constraintList_copy (p->ensuresConstraints); + + t = reflectChanges (trueBranch->requiresConstraints, p->trueEnsuresConstraints); + t = reflectChanges (t, p->ensuresConstraints); + + // e->requiresConstraints = constraintList_copy (cons); + + cons = reflectChanges (falseBranch->requiresConstraints, p->falseEnsuresConstraints); + cons = reflectChanges (cons, c1); + + e->requiresConstraints = constraintList_mergeRequires (t, cons); + e->requiresConstraints = constraintList_mergeRequires (e->requiresConstraints, p->requiresConstraints); + + // do ensures clauses + // find the the ensures lists for each subbranch + t = constraintList_mergeEnsures (p->trueEnsuresConstraints, trueBranch->ensuresConstraints); + t = constraintList_mergeEnsures (p->ensuresConstraints, t); + + f = constraintList_mergeEnsures (p->falseEnsuresConstraints, falseBranch->ensuresConstraints); + f = constraintList_mergeEnsures (p->ensuresConstraints, f); + + // find ensures for whole if/else statement + + e->ensuresConstraints = constraintList_logicalOr (t, f); + + return e; +} exprNode doWhile (exprNode e, exprNode test, exprNode body) { @@ -333,6 +392,7 @@ exprNode doWhile (exprNode e, exprNode test, exprNode body) constraintList constraintList_makeFixedArrayConstraints (sRefSet s) { constraintList ret; + constraint con; ret = constraintList_new(); sRefSet_elements (s, el) @@ -341,7 +401,10 @@ constraintList constraintList_makeFixedArrayConstraints (sRefSet s) if (sRef_isFixedArray(el) ) { int s; - constraint con; + DPRINTF( (message("%s is a fixed array", + sRef_unparse(el)) ) ); + //if (el->kind == SK_DERIVED) + // break; //hack until I find the real problem s = sRef_getArraySize(el); DPRINTF( (message("%s is a fixed array with size %d", sRef_unparse(el), s) ) ); @@ -353,10 +416,25 @@ constraintList constraintList_makeFixedArrayConstraints (sRefSet s) { DPRINTF( (message("%s is not a fixed array", sRef_unparse(el)) ) ); + + + if (sRef_isExternallyVisible (el) ) + { + /*DPRINTF( (message("%s is externally visible", + sRef_unparse(el) ) )); + con = constraint_makeSRefWriteSafeInt(el, 0); + ret = constraintList_add(ret, con); + + con = constraint_makeSRefReadSafeInt(el, 0); + + ret = constraintList_add(ret, con);*/ + } } } end_sRefSet_elements + DPRINTF(( message("constraintList_makeFixedArrayConstraints returning %s", + constraintList_print(ret) ) )); return ret; } @@ -408,6 +486,26 @@ void doFor (exprNode e, exprNode forPred, exprNode forBody) } +exprNode doSwitch (/*@returned@*/ exprNode e) +{ + exprNode body; + exprData data; + + data = e->edata; + llassert(FALSE); + //TPRINTF (( message ("doSwitch for: switch (%s) %s", + // exprNode_unparse (exprData_getPairA (data)), + // exprNode_unparse (exprData_getPairB (data))) )); + + body = exprData_getPairB (data); + + // exprNode_generateConstraints(body); + + // e->requiresConstraints = constraintList_copy ( body->requiresConstraints ); + //e->ensuresConstraints = constraintList_copy ( body->ensuresConstraints ); + + return e; +} bool exprNode_multiStatement (exprNode e) @@ -418,9 +516,8 @@ bool exprNode_multiStatement (exprNode e) exprNode e1, e2; exprNode p, trueBranch, falseBranch; exprNode forPred, forBody; - exprNode init, test, inc; - constraintList cons; - constraintList t, f; + exprNode test; + // constraintList t, f; e->requiresConstraints = constraintList_new(); e->ensuresConstraints = constraintList_new(); e->trueEnsuresConstraints = constraintList_new(); @@ -515,48 +612,26 @@ bool exprNode_multiStatement (exprNode e) exprNode_generateConstraints (falseBranch); p->ensuresConstraints = exprNode_traversEnsuresConstraints (p); + p->requiresConstraints = exprNode_traversRequiresConstraints (p); + p->trueEnsuresConstraints = exprNode_traversTrueEnsuresConstraints(p); - // p->falseEnsuresConstraints = exprNode_traversFalseEnsuresConstraints(p); - - // do requires clauses - - { - constraintList c1, c2; - c1 = constraintList_copy (p->ensuresConstraints); - - cons = reflectChanges (trueBranch->requiresConstraints, p->trueEnsuresConstraints); - cons = reflectChanges (cons, - p->ensuresConstraints); - e->requiresConstraints = constraintList_copy (cons); - /* - cons = reflectChanges (falseBranch->requiresConstraints, p->falseEnsuresConstraints); - cons = reflectChanges (cons, - c1); - e->requiresConstraints = constraintList_addList (e->requiresConstraints, - cons); - e->requiresConstraints = constraintList_addList (e->requiresConstraints, - p->requiresConstraints); - */ - - } - // do ensures clauses - // find the the ensures lists for each subbranch - t = constraintList_mergeEnsures (p->trueEnsuresConstraints, trueBranch->ensuresConstraints); - t = constraintList_mergeEnsures (p->ensuresConstraints, t); - - f = constraintList_mergeEnsures (p->falseEnsuresConstraints, falseBranch->ensuresConstraints); - f = constraintList_mergeEnsures (p->ensuresConstraints, f); + p->falseEnsuresConstraints = exprNode_traversFalseEnsuresConstraints(p); - // find ensures for whole if/else statement - - e->ensuresConstraints = constraintList_logicalOr (t, f); + e = doIfElse (e, p, trueBranch, falseBranch); DPRINTF( ("Done IFELSE") ); break; case XPR_DOWHILE: - // ret = message ("do { %s } while (%s)", - exprNode_generateConstraints (exprData_getPairB (data)); - exprNode_generateConstraints (exprData_getPairA (data)); + + e2 = (exprData_getPairB (data)); + e1 = (exprData_getPairA (data)); + + DPRINTF((message ("do { %s } while (%s)", exprNode_unparse(e2), exprNode_unparse(e1) ) )); + exprNode_generateConstraints (e2); + exprNode_generateConstraints (e1); + e = exprNode_copyConstraints (e, e2); + DPRINTF ((message ("e = %s ", constraintList_print(e->requiresConstraints) ) )); + break; case XPR_BLOCK: @@ -567,6 +642,9 @@ bool exprNode_multiStatement (exprNode e) // e->constraints = (exprData_getSingle (data))->constraints; break; + case XPR_SWITCH: + e = doSwitch (e); + break; case XPR_STMT: case XPR_STMTLIST: return exprNode_stmtList (e); @@ -731,20 +809,20 @@ bool exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv, filel exprData data; constraint cons; - if (exprNode_isError(e) ) - { - return FALSE; - } - - DPRINTF((message ("exprNode_exprTraverset Analysising %s %s at", exprNode_unparse( e), + if (exprNode_isError(e) ) + { + return FALSE; + } + + DPRINTF((message ("exprNode_exprTraverset Analysising %s %s at", exprNode_unparse( e), fileloc_unparse(exprNode_getfileloc(e) ) ) ) ); - - e->requiresConstraints = constraintList_new(); - e->ensuresConstraints = constraintList_new(); - e->trueEnsuresConstraints = constraintList_new();; - e->falseEnsuresConstraints = constraintList_new();; - - if (exprNode_isUnhandled (e) ) + + e->requiresConstraints = constraintList_new(); + e->ensuresConstraints = constraintList_new(); + e->trueEnsuresConstraints = constraintList_new();; + e->falseEnsuresConstraints = constraintList_new();; + + if (exprNode_isUnhandled (e) ) { return FALSE; } @@ -962,6 +1040,64 @@ bool exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv, filel e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); } break; + case XPR_CAST: + llassert(FALSE); + exprNode_exprTraverse (exprData_getCastNode (data), definatelv, definaterv, sequencePoint ); + break; + case XPR_COND: + { + exprNode pred, true, false; + llassert(FALSE); + pred = exprData_getTriplePred (data); + true = exprData_getTripleTrue (data); + false = exprData_getTripleFalse (data); + + exprNode_exprTraverse (pred, FALSE, TRUE, sequencePoint ); + pred->ensuresConstraints = exprNode_traversEnsuresConstraints(pred); + pred->requiresConstraints = exprNode_traversRequiresConstraints(pred); + + pred->trueEnsuresConstraints = exprNode_traversTrueEnsuresConstraints(pred); + pred->falseEnsuresConstraints = exprNode_traversFalseEnsuresConstraints(pred); + + exprNode_exprTraverse (true, FALSE, TRUE, sequencePoint ); + true->ensuresConstraints = exprNode_traversEnsuresConstraints(true); + true->requiresConstraints = exprNode_traversRequiresConstraints(true); + + true->trueEnsuresConstraints = exprNode_traversTrueEnsuresConstraints(true); + true->falseEnsuresConstraints = exprNode_traversFalseEnsuresConstraints(true); + + exprNode_exprTraverse (false, FALSE, TRUE, sequencePoint ); + false->ensuresConstraints = exprNode_traversEnsuresConstraints(false); + false->requiresConstraints = exprNode_traversRequiresConstraints(false); + + false->trueEnsuresConstraints = exprNode_traversTrueEnsuresConstraints(false); + false->falseEnsuresConstraints = exprNode_traversFalseEnsuresConstraints(false); + + + /* if pred is true e equals true otherwise pred equals false */ + + cons = constraint_makeEnsureEqual (e, true, sequencePoint); + true->ensuresConstraints = constraintList_add(true->ensuresConstraints, cons); + + cons = constraint_makeEnsureEqual (e, true, sequencePoint); + false->ensuresConstraints = constraintList_add(false->ensuresConstraints, cons); + + e = doIfElse (e, pred, true, false); + + } + break; + case XPR_COMMA: + llassert(FALSE); + t1 = exprData_getPairA (data); + t2 = exprData_getPairB (data); + /* we essiantially treat this like expr1; expr2 + of course sequencePoint isn't adjusted so this isn't completely accurate + problems../ */ + exprNode_exprTraverse (t1, FALSE, FALSE, sequencePoint ); + exprNode_exprTraverse (t2, definatelv, definaterv, sequencePoint ); + mergeResolve (e, t1, t2); + break; + default: handledExprNode = FALSE; } @@ -980,7 +1116,7 @@ bool exprNode_exprTraverse (exprNode e, bool definatelv, bool definaterv, filel constraintList exprNode_traversTrueEnsuresConstraints (exprNode e) { - exprNode t1, t2; + exprNode t1; bool handledExprNode; // char * mes; @@ -1101,6 +1237,15 @@ constraintList exprNode_traversTrueEnsuresConstraints (exprNode e) exprNode_traversTrueEnsuresConstraints (exprData_getUopNode (data) ) ); break; + + case XPR_CAST: + + ret = constraintList_addList (ret, + exprNode_traversTrueEnsuresConstraints + (exprData_getCastNode (data) ) ); + break; + + break; default: break; } @@ -1110,7 +1255,7 @@ constraintList exprNode_traversTrueEnsuresConstraints (exprNode e) constraintList exprNode_traversFalseEnsuresConstraints (exprNode e) { - exprNode t1, t2; + exprNode t1; bool handledExprNode; // char * mes; @@ -1231,6 +1376,14 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e) exprNode_traversFalseEnsuresConstraints (exprData_getUopNode (data) ) ); break; + + case XPR_CAST: + + ret = constraintList_addList (ret, + exprNode_traversFalseEnsuresConstraints + (exprData_getCastNode (data) ) ); + break; + default: break; } @@ -1242,7 +1395,7 @@ constraintList exprNode_traversFalseEnsuresConstraints (exprNode e) /* walk down the tree and get all requires Constraints in each subexpression*/ constraintList exprNode_traversRequiresConstraints (exprNode e) { - exprNode t1, t2; + exprNode t1; bool handledExprNode; // char * mes; @@ -1363,6 +1516,14 @@ constraintList exprNode_traversRequiresConstraints (exprNode e) exprNode_traversRequiresConstraints (exprData_getUopNode (data) ) ); break; + + case XPR_CAST: + + ret = constraintList_addList (ret, + exprNode_traversRequiresConstraints + (exprData_getCastNode (data) ) ); + break; + default: break; } @@ -1374,7 +1535,7 @@ constraintList exprNode_traversRequiresConstraints (exprNode e) /* walk down the tree and get all Ensures Constraints in each subexpression*/ constraintList exprNode_traversEnsuresConstraints (exprNode e) { - exprNode t1, t2; + exprNode t1; bool handledExprNode; // char * mes; @@ -1506,6 +1667,13 @@ constraintList exprNode_traversEnsuresConstraints (exprNode e) exprNode_traversEnsuresConstraints (exprData_getUopNode (data) ) ); break; + case XPR_CAST: + + ret = constraintList_addList (ret, + exprNode_traversEnsuresConstraints + (exprData_getCastNode (data) ) ); + break; + default: break; } diff --git a/src/constraintResolve.c b/src/constraintResolve.c index 36dd667..ee1e63a 100644 --- a/src/constraintResolve.c +++ b/src/constraintResolve.c @@ -45,7 +45,8 @@ constraintList constraintList_mergeEnsures (constraintList list1, constraintList { constraintList ret; constraintList temp; - ret = constraintList_new(); + + //ret = constraintList_new(); ret = reflectChangesEnsures (list1, list2); ret = constraintList_fixConflicts (ret, list2); @@ -59,6 +60,28 @@ constraintList constraintList_mergeEnsures (constraintList list1, constraintList //return ret; } +constraintList constraintList_mergeRequires (constraintList list1, constraintList list2) +{ + constraintList ret; + constraintList temp; + + DPRINTF((message ("constraintList_mergeRequires: merging %s and %s ", constraintList_print (list1), constraintList_print(list2) ) ) ); + + /* get constraints in list1 not satified by list2 */ + temp = reflectChanges (list1, list2); + DPRINTF((message ("constraintList_mergeRequires: temp = %s", constraintList_print(temp) ) ) ); + +/*get constraints in list2 not satified by temp*/ + ret = reflectChanges (list2, temp); + + DPRINTF((message ("constraintList_mergeRequires: ret = %s", constraintList_print(ret) ) ) ); + + ret = constraintList_addList (ret, temp); + + DPRINTF((message ("constraintList_mergeRequires: returning %s", constraintList_print(ret) ) ) ); + + return ret; +} /* constraintList constraintList_resolveRequires (constraintList requires, constraintList ensures) */ /* { */ @@ -195,7 +218,8 @@ void mergeResolve (exprNode parent, exprNode child1, exprNode child2) parent->requiresConstraints = constraintList_copy (child1->requiresConstraints); temp = reflectChanges (child2->requiresConstraints, child1->ensuresConstraints); - parent->requiresConstraints = constraintList_addList (parent->requiresConstraints, temp); + + parent->requiresConstraints = constraintList_mergeRequires (parent->requiresConstraints, temp); parent->ensuresConstraints = constraintList_mergeEnsures(child1->ensuresConstraints, child2->ensuresConstraints); @@ -231,7 +255,7 @@ constraintList constraintList_subsumeEnsures (constraintList list1, constraintLi return ret; } - +/* tries to resolve constraints in list pr2 using post1 */ constraintList reflectChanges (constraintList pre2, constraintList post1) { @@ -666,12 +690,13 @@ constraint substitute (constraint c, constraintList p) temp = constraint_adjust(temp, c); - DPRINTF((message ("Substituting %s for %s", + DPRINTF((message ("Substituting %s in the constraint %s", constraint_print (temp), constraint_print (c) ) ) ); c = constraint_searchandreplace (c, temp->lexpr, temp->expr); + DPRINTF(( message ("The new constraint is %s", constraint_print (c) ) )); } } end_constraintList_elements; diff --git a/src/exprChecks.c b/src/exprChecks.c index 44eb80b..4b90d09 100644 --- a/src/exprChecks.c +++ b/src/exprChecks.c @@ -884,6 +884,7 @@ void exprNode_checkFunctionBody (exprNode body) } } + /* drl added call*/ exprNode_checkFunction (context_getHeader (), body); if (!checkret) @@ -894,6 +895,8 @@ void exprNode_checkFunctionBody (exprNode body) } /*drl modified */ +extern constraintList implicitFcnConstraints; + void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body) { constraintList c, t; @@ -920,11 +923,11 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body) c2 = constraintList_copy (c); fix = constraintList_makeFixedArrayConstraints (body->uses); c2 = reflectChanges (c2, constraintList_copy(fix) ); - + t = reflectChanges (body->requiresConstraints, constraintList_copy (c2) ); body->requiresConstraints = constraintList_copy (t); - DPRINTF ( (message ("The body has the required cosntraints: %s", constraintList_printDetailed (t) ) ) ); + DPRINTF ( (message ("The body has the required constraints: %s", constraintList_printDetailed (t) ) ) ); t = constraintList_mergeEnsures (c, body->ensuresConstraints); body->ensuresConstraints = constraintList_copy (t); @@ -941,6 +944,14 @@ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body) DPRINTF((message ("The Function %s has no preconditions", uentry_unparse(ue) ) ) ); } + if ( implicitFcnConstraints) + { + if (context_getFlag (FLG_IMPLICTCONSTRAINT) ) + { + body->requiresConstraints = reflectChanges (body->requiresConstraints, constraintList_copy (implicitFcnConstraints) ); + } + } + constraintList_printError(body->requiresConstraints, g_currentloc); constraintList_printError(body->ensuresConstraints, g_currentloc); diff --git a/src/exprNode.c b/src/exprNode.c index 9fffc7c..6491d07 100644 --- a/src/exprNode.c +++ b/src/exprNode.c @@ -738,9 +738,9 @@ exprNode_stringLiteral (/*@only@*/ cstring t, /*@only@*/ fileloc loc) /* This expr is null terminated, so we set the len and size */ sRef_setNullTerminatedState(e->sref); /* - TPRINTF("Len is set to : %d\n\n", strlen((char *)multiVal_forceString(e->val))); - TPRINTF("Size is set to : %d\n\n", strlen((char *)multiVal_forceString(e->val))); - TPRINTF("State is set to: %d\n\n", e->sref->bufinfo.bufstate); + DPRINTF("Len is set to : %d\n\n", strlen((char *)multiVal_forceString(e->val))); + DPRINTF("Size is set to : %d\n\n", strlen((char *)multiVal_forceString(e->val))); + DPRINTF("State is set to: %d\n\n", e->sref->bufinfo.bufstate); */ sRef_setLen(e->sref, strlen((char *)multiVal_forceString(e->val))); sRef_setSize(e->sref, strlen((char *)multiVal_forceString(e->val))); diff --git a/src/flags.def b/src/flags.def index 9fcd65d..dc211c4 100644 --- a/src/flags.def +++ b/src/flags.def @@ -2813,8 +2813,17 @@ NULL, NULL, FLG_CONSTRAINTLOCATION, "display full c expression for every constraint generated", ", ", + 0, 0 + },/*drl added flag 4/26/01*/ +{ + FK_NT, FK_MEMORY, modeFlag, + "implictconstraint", + FLG_IMPLICTCONSTRAINT, + "Try to generate implicit constraints for functions", + ", ", 0, 0 }, + { FK_NT, FK_MEMORY, modeFlag, "nullterminated", diff --git a/src/sRef.c b/src/sRef.c index e285fa0..0e6dc60 100644 --- a/src/sRef.c +++ b/src/sRef.c @@ -9173,7 +9173,8 @@ bool sRef_isFixedArray (sRef p_s) /*@*/ { long int sRef_getArraySize (sRef p_s) /*@*/ { ctype c; llassert (sRef_isFixedArray(p_s) ); - + DPRINTF (( message ("sRef_getArraySize getting array size for %s", sRef_unparse(p_s) ) )); + c = sRef_getType (p_s); return (ctype_getArraySize (c) ); diff --git a/src/uentry.c b/src/uentry.c index 4b1eda5..2a59a08 100644 --- a/src/uentry.c +++ b/src/uentry.c @@ -575,11 +575,11 @@ constraintList uentry_getFcnPreconditions (uentry ue) //llassert ((ue->info->fcn->preconditions)); if (!uentry_isFunction (ue)) { - TPRINTF ( (message ("called uentry_getFcnPreconditions on nonfunction %s", + DPRINTF ( (message ("called uentry_getFcnPreconditions on nonfunction %s", uentry_unparse (ue) ) ) ); if (!uentry_isSpecified (ue) ) { - TPRINTF((message ("called uentry_getFcnPreconditions on nonfunction %s", + DPRINTF((message ("called uentry_getFcnPreconditions on nonfunction %s", uentry_unparse (ue) ) )); return constraintList_undefined; } @@ -629,7 +629,7 @@ constraintList uentry_getFcnPostconditions (uentry ue) if (!uentry_isFunction (ue)) { - /*llcontbug*/ TPRINTF( (message ("called uentry_getFcnPostconditions on nonfunction %s", + /*llcontbug*/ DPRINTF( (message ("called uentry_getFcnPostconditions on nonfunction %s", uentry_unparse (ue) ) ) ); return constraintList_undefined; } -- 2.45.2