- Timestamp:
- Aug 2, 2012 3:34:40 AM (12 years ago)
- Location:
- trunk/src/kObjCache
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kObjCache/Makefile.kmk
r2612 r2618 29 29 PROGRAMS += kObjCache 30 30 kObjCache_TEMPLATE = BIN 31 kObjCache_DEFS.release = NASSERT 31 32 kObjCache_SOURCES = kObjCache.c 32 33 kObjCache_LIBS = \ -
trunk/src/kObjCache/kObjCache.c
r2617 r2618 885 885 886 886 887 static void kOCDepEnter(PKOCDEP pDepState, const char *pszUnescFilename, size_t cchFilename) 888 { 889 if (cchFilename + 1 >= pDepState->cbFilenameAlloced) 890 { 891 pDepState->cbFilenameAlloced = (cchFilename + 1 + 15) & ~15; 892 pDepState->pszFilename = (char *)xrealloc(pDepState->pszFilename, pDepState->cbFilenameAlloced); 893 } 894 895 memcpy(pDepState->pszFilename, pszUnescFilename, cchFilename); 896 pDepState->pszFilename[cchFilename] = '\0'; 897 cchFilename = kOCDepUnescape(pDepState->pszFilename); 898 899 if ( !pDepState->pCurDep 900 || cchFilename != pDepState->pCurDep->cchFilename 901 || strcmp(pDepState->pszFilename, pDepState->pCurDep->szFilename)) 902 pDepState->pCurDep = depAdd(pDepState->pszFilename, cchFilename); 903 } 904 905 887 906 /** 888 907 * This consumes the preprocessor output and generate dependencies from it. … … 1110 1129 size_t cbBufAlloc; 1111 1130 /** Amount preprocessor output that we've completed optimizations for. */ 1112 size_t cchOptimized; 1131 size_t cchDstOptimized; 1132 /** Offset to the start of the unoptimized source. */ 1133 size_t offSrcUnoptimized; 1113 1134 /** The offset of the next bits to process. */ 1114 size_t off Cur;1135 size_t offSrcCur; 1115 1136 /** The offset where to put more raw preprocessor output. */ 1116 size_t off Read;1137 size_t offSrcRead; 1117 1138 /** The line number corresponding to offOptimized. */ 1118 1139 uint32_t uOptLineNo; 1119 1140 /** The current line number. */ 1120 1141 uint32_t uCurLineNo; 1121 /** The number of lines found to be empty starting at cchOptimized. */1122 uint32_t cEmptyLines;1123 1142 /** Set if we're done, clear if we're expecting more preprocessor output. */ 1124 1143 int fDone; … … 1139 1158 /** The size of the buffer pointed to by pszLineBuf. */ 1140 1159 size_t cbLineBuf; 1160 1161 /** Set if we should work the dependency generator as well. */ 1162 PKOCDEP pDepState; 1141 1163 } KOCCPPRD; 1142 1164 /** Pointer to a preprocessor reader state. */ … … 1151 1173 * there was not previous run. 1152 1174 * @param fOptimize Whether optimizations are enabled. 1153 */ 1154 static void kOCCppRdInit(PKOCCPPRD pCppRd, size_t cbOldCpp, int fOptimize) 1155 { 1175 * @param pDepState Pointer to the dependency generator. Must only be set 1176 * if @a fOptimize is also set. 1177 */ 1178 static void kOCCppRdInit(PKOCCPPRD pCppRd, size_t cbOldCpp, int fOptimize, PKOCDEP pDepState) 1179 { 1180 assert(!pDepState || fOptimize); 1181 1156 1182 pCppRd->cbBufAlloc = cbOldCpp ? (cbOldCpp + KOC_BUF_INCR) & ~(KOC_BUF_ALIGNMENT - 1) : KOC_BUF_MIN; 1157 1183 pCppRd->pszBuf = xmalloc(pCppRd->cbBufAlloc); 1158 1184 pCppRd->cchCurFileNm = 0; 1159 pCppRd->cchOptimized = 0; 1160 pCppRd->offCur = 0; 1161 pCppRd->offRead = 0; 1185 pCppRd->cchDstOptimized = 0; 1186 pCppRd->offSrcUnoptimized = 0; 1187 pCppRd->offSrcCur = 0; 1188 pCppRd->offSrcRead = 0; 1162 1189 pCppRd->uOptLineNo = 1; 1163 1190 pCppRd->uCurLineNo = 1; 1164 pCppRd->cEmptyLines = 0;1165 1191 pCppRd->fDone = 0; 1166 1192 pCppRd->chSaved = 0; … … 1173 1199 pCppRd->pszLineBuf = NULL; 1174 1200 pCppRd->cbLineBuf = 0; 1201 1202 pCppRd->pDepState = pDepState; 1175 1203 } 1176 1204 … … 1199 1227 pCppRd->pszBuf = xrealloc(pCppRd->pszBuf, pCppRd->cbBufAlloc); 1200 1228 1201 return pCppRd->cbBufAlloc - pCppRd->offRead; 1202 } 1203 1204 1205 static char *kOCCppRdOptRemove(PKOCCPPRD pCppRd, char *pszStart, size_t cbRemove) 1206 { 1207 size_t offStart = pszStart - pCppRd->pszBuf; 1208 size_t cbToMove = pCppRd->offRead - offStart; 1209 1210 assert(pCppRd->offRead >= offStart); 1211 1212 g_cMemMoves++; 1213 g_cbMemMoved += cbToMove + 1; 1214 memmove(pszStart, pszStart + cbRemove, cbToMove + 1); 1215 1216 pCppRd->offRead -= cbRemove; 1217 assert(offStart >= pCppRd->offCur); 1218 assert(pCppRd->offRead < 1 || pCppRd->pszBuf[pCppRd->offRead - 1] != '\0'); 1219 return pszStart; 1220 } 1221 1222 1223 static size_t kOCCppRdOptReplace(PKOCCPPRD pCppRd, size_t offStart, size_t cchReplaced, 1224 const char *pchReplacement, size_t cchReplacement) 1225 { 1226 size_t offDelta = cchReplacement - cchReplaced; 1227 1228 if (offDelta) 1229 { 1230 size_t cbToMove = pCppRd->offRead - offStart - cchReplaced; 1231 assert(cbToMove <= pCppRd->offRead); 1232 1233 if (cchReplacement > cchReplaced) 1234 while (pCppRd->offRead + offDelta >= pCppRd->cbBufAlloc) 1235 kOCCppRdGrowBuffer(pCppRd); 1229 return pCppRd->cbBufAlloc - pCppRd->offSrcRead; 1230 } 1231 1232 1233 static size_t kOCCppRdOptInsert(PKOCCPPRD pCppRd, size_t cchSrcReplaced, const char *pchInsert, size_t cchInsert) 1234 { 1235 size_t offDelta = 0; 1236 size_t cchAvail; 1237 1238 pCppRd->offSrcUnoptimized += cchSrcReplaced; 1239 assert(pCppRd->offSrcUnoptimized <= pCppRd->offSrcCur); 1240 cchAvail = pCppRd->offSrcUnoptimized - pCppRd->cchDstOptimized; 1241 if (cchAvail < cchInsert) 1242 { 1243 size_t const cbToMove = pCppRd->offSrcRead - pCppRd->offSrcUnoptimized; 1244 assert(cbToMove <= pCppRd->offSrcRead); 1245 offDelta = cchInsert - cchAvail; 1246 1247 while (pCppRd->offSrcRead + offDelta >= pCppRd->cbBufAlloc) 1248 kOCCppRdGrowBuffer(pCppRd); 1236 1249 1237 1250 g_cMemMoves++; 1238 1251 g_cbMemMoved += cbToMove + 1; 1239 memmove(pCppRd->pszBuf + offStart + cchReplacement,1240 pCppRd->pszBuf + offStart + cchReplaced,1252 memmove(pCppRd->pszBuf + pCppRd->offSrcUnoptimized + offDelta, 1253 pCppRd->pszBuf + pCppRd->offSrcUnoptimized, 1241 1254 cbToMove + 1); 1242 1255 1243 pCppRd->offRead += offDelta; 1244 if (pCppRd->offCur > offStart) 1245 { 1246 assert(pCppRd->offCur >= offStart + cchReplaced); 1247 pCppRd->offCur += offDelta; 1248 } 1249 assert(pCppRd->offRead < 1 || pCppRd->pszBuf[pCppRd->offRead - 1] != '\0'); 1250 } 1251 1252 memcpy(pCppRd->pszBuf + offStart, pchReplacement, cchReplacement); 1256 pCppRd->offSrcRead += offDelta; 1257 pCppRd->offSrcUnoptimized += offDelta; 1258 pCppRd->offSrcCur += offDelta; 1259 assert(pCppRd->offSrcRead < 1 || pCppRd->pszBuf[pCppRd->offSrcRead - 1] != '\0'); 1260 } 1261 1262 memcpy(pCppRd->pszBuf + pCppRd->cchDstOptimized, pchInsert, cchInsert); 1263 pCppRd->cchDstOptimized += cchInsert; 1253 1264 1254 1265 return offDelta; … … 1256 1267 1257 1268 1258 static void kOCCppRdOptCommitEx(PKOCCPPRD pCppRd, size_t offCur)1259 {1260 pCppRd->cchOptimized = offCur;1261 pCppRd->uOptLineNo = pCppRd->uCurLineNo;1262 }1263 1264 1265 1269 static void kOCCppRdOptCommit(PKOCCPPRD pCppRd) 1266 1270 { 1267 pCppRd->cchOptimized = pCppRd->offCur; 1271 size_t cchToCommit = pCppRd->offSrcCur - pCppRd->offSrcUnoptimized; 1272 assert(pCppRd->offSrcUnoptimized <= pCppRd->offSrcCur); 1273 1274 if (cchToCommit) 1275 { 1276 memmove(pCppRd->pszBuf + pCppRd->cchDstOptimized, pCppRd->pszBuf + pCppRd->offSrcUnoptimized, cchToCommit); 1277 pCppRd->cchDstOptimized += cchToCommit; 1278 pCppRd->offSrcUnoptimized = pCppRd->offSrcCur; 1279 } 1280 1268 1281 pCppRd->uOptLineNo = pCppRd->uCurLineNo; 1269 1282 } … … 1342 1355 1343 1356 1344 static char *kOCCppRdOptFlush(PKOCCPPRD pCppRd, char *pszCur, int fLineDirNext) 1345 { 1346 size_t const cchOptimized = pCppRd->cchOptimized; 1347 size_t const offTmp = pszCur - pCppRd->pszBuf; 1348 assert(offTmp >= cchOptimized); 1349 if (pCppRd->offCur > cchOptimized) 1357 static size_t kOCCppRdOptFlush(PKOCCPPRD pCppRd, size_t offSrcCur, int fLineDirNext) 1358 { 1359 size_t offDelta = 0; 1360 size_t const offSrcUnoptimized = pCppRd->offSrcUnoptimized; 1361 assert(offSrcUnoptimized <= offSrcCur); 1362 1363 if (offSrcCur > offSrcUnoptimized) 1350 1364 { 1351 1365 /* 1352 1366 * We've got unflushed whitelines. 1353 1367 */ 1354 size_t const cch InQuestion = pCppRd->offCur - cchOptimized;1368 size_t const cchSrcInQuestion = offSrcCur - offSrcUnoptimized; 1355 1369 uint32_t const cLinesInQuestion = pCppRd->uCurLineNo - pCppRd->uOptLineNo; 1356 1370 size_t cchLineDir; 1357 size_t offDelta;1358 1371 1359 1372 if ( cLinesInQuestion <= 7 … … 1361 1374 cchLineDir = kOCCppRdOptFmtNewLines(pCppRd, cLinesInQuestion); 1362 1375 1363 offDelta = kOCCppRdOptReplace(pCppRd, cchOptimized, cchInQuestion, pCppRd->pszLineBuf, cchLineDir); 1364 pszCur += offDelta; 1365 1366 kOCCppRdOptCommitEx(pCppRd, cchOptimized + cchLineDir); 1367 /* pCppRd->offCur is adjusted by the replace call */ 1376 offDelta = kOCCppRdOptInsert(pCppRd, cchSrcInQuestion, pCppRd->pszLineBuf, cchLineDir); 1368 1377 } 1369 1378 1370 1379 (void)fLineDirNext; /* Use later if required. */ 1371 return pszCur;1380 return offDelta; 1372 1381 } 1373 1382 … … 1467 1476 static char *kOCCppRdOptHandleLine(PKOCCPPRD pCppRd, char *pszCur, size_t *pcbLeft, int *pfEmptyLine, char *pszEol) 1468 1477 { 1469 size_t const cchEol = pszEol - pszCur; 1478 size_t const offSrcLine = pCppRd->offSrcCur; 1479 size_t const cchSrcLine = pszEol - pCppRd->pszBuf - pCppRd->offSrcCur; 1480 size_t const cbLeftAssert = *pcbLeft; 1470 1481 char *pszNewFile; 1471 1482 size_t cchNewFile; … … 1473 1484 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1474 1485 1486 /* Advance to the end of the line before we do anything. This can be a 1487 little confusing but it saves effort and avoid trouble in the end. */ 1488 pCppRd->offSrcCur = pszEol - pCppRd->pszBuf; 1489 *pcbLeft -= pszEol - pszCur; 1490 assert(*pcbLeft <= cbLeftAssert); (void)cbLeftAssert; 1491 1492 /* 1493 * Try parse the directive a '#line' one.... 1494 */ 1475 1495 if (!kOCCppRdOptParseLine(pCppRd, pszCur, pszEol, &uNewLineNo, &pszNewFile, &cchNewFile)) 1476 1496 { … … 1479 1499 * the line isn't empty and needs to be commited at EOL. 1480 1500 */ 1481 pszEol = kOCCppRdOptFlush(pCppRd, pszEol, 0);1501 kOCCppRdOptFlush(pCppRd, offSrcLine, 0); 1482 1502 *pfEmptyLine = 0; 1483 1503 } … … 1500 1520 * the file and emit another directive for starting the new one. 1501 1521 */ 1502 size_t const cchOrgLine = pszEol - pCppRd->pszBuf - pCppRd->offCur;1503 1522 size_t cchLineDir; 1504 pszEol = kOCCppRdOptFlush(pCppRd, pszEol, 1);1523 kOCCppRdOptFlush(pCppRd, offSrcLine, 1); 1505 1524 1506 1525 cchLineDir = kOCCppRdOptFmtLine(pCppRd, uNewLineNo, NULL, 0) - 1; /* sans \n */ 1507 1508 pszEol += kOCCppRdOptReplace(pCppRd, pCppRd->offCur, cchOrgLine, 1509 pCppRd->pszLineBuf, cchLineDir); 1526 kOCCppRdOptInsert(pCppRd, cchSrcLine, pCppRd->pszLineBuf, cchLineDir); 1510 1527 1511 1528 *pfEmptyLine = 0; … … 1517 1534 * The #line directive changed the file. 1518 1535 */ 1519 size_t const cchOrgLine = pszEol - pCppRd->pszBuf - pCppRd->offCur;1520 1536 size_t cchLineDir; 1521 size_t offDelta; 1522 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1523 1524 offDelta = kOCCppRdOptFlush(pCppRd, pszEol, 1) - pszEol; 1525 pszEol += offDelta; 1526 pszNewFile += offDelta; 1527 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1528 1529 kOCCppRdOptSetFile(pCppRd, pszNewFile, cchNewFile); 1530 cchLineDir = kOCCppRdOptFmtLine(pCppRd, uNewLineNo, pszNewFile, cchNewFile) - 1; /* sans \n */ 1531 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1532 1533 pszEol += kOCCppRdOptReplace(pCppRd, pCppRd->offCur, cchOrgLine, 1534 pCppRd->pszLineBuf, cchLineDir); 1535 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1537 1538 kOCCppRdOptSetFile(pCppRd, pszNewFile, cchNewFile); /* save to do this early */ 1539 kOCCppRdOptFlush(pCppRd, offSrcLine, 1); 1540 1541 cchLineDir = kOCCppRdOptFmtLine(pCppRd, uNewLineNo, pCppRd->pszFileNmBuf, cchNewFile) - 1; /* sans \n */ 1542 kOCCppRdOptInsert(pCppRd, cchSrcLine, pCppRd->pszLineBuf, cchLineDir); 1543 1544 if (pCppRd->pDepState) 1545 kOCDepEnter(pCppRd->pDepState, pCppRd->pszFileNmBuf, cchNewFile); 1536 1546 1537 1547 *pfEmptyLine = 0; … … 1539 1549 1540 1550 pCppRd->uCurLineNo = uNewLineNo - 1; 1541 assert(*pszEol == '\r' || *pszEol == '\n' || *pszEol == '\0'); 1542 } 1543 1544 pCppRd->offCur = pszEol - pCppRd->pszBuf; 1545 *pcbLeft -= cchEol; 1546 return pszEol; 1551 } 1552 1553 return pCppRd->pszBuf + pCppRd->offSrcCur; 1547 1554 } 1548 1555 … … 1552 1559 size_t cch; 1553 1560 char *pszEol; 1554 char *pszCur = pCppRd->pszBuf + pCppRd->off Cur;1555 size_t cbTodo = pCppRd->off Read - pCppRd->offCur;1561 char *pszCur = pCppRd->pszBuf + pCppRd->offSrcCur; 1562 size_t cbTodo = pCppRd->offSrcRead - pCppRd->offSrcCur; 1556 1563 int fEmptyLine = 1; 1557 1564 … … 1565 1572 1566 1573 case '\n': 1567 pCppRd->off Cur = pszCur - pCppRd->pszBuf + 1;1574 pCppRd->offSrcCur = pszCur - pCppRd->pszBuf + 1; 1568 1575 pCppRd->uCurLineNo++; 1569 1576 if (!fEmptyLine) 1570 1577 kOCCppRdOptCommit(pCppRd); 1571 else1572 pCppRd->cEmptyLines++;1573 1578 fEmptyLine = 1; 1574 1579 break; 1575 1580 1576 1581 case '\r': /* "\r\n" -> "\n" */ 1577 if (cbTodo == 1 && !pCppRd->fDone)1582 if (cbTodo <= 1 && !pCppRd->fDone) 1578 1583 return; 1579 if (pszCur[1] == '\n' )1584 if (pszCur[1] == '\n' && !fEmptyLine) 1580 1585 { 1581 pszCur = kOCCppRdOptRemove(pCppRd, pszCur, 1); 1582 cbTodo -= 1; 1586 /* Commit the part up to the '\r' first, replace '\r\n' with '\n'. */ 1587 pCppRd->offSrcCur = pszCur - pCppRd->pszBuf; 1588 kOCCppRdOptCommit(pCppRd); 1589 1590 pCppRd->offSrcCur += 2; 1591 kOCCppRdOptInsert(pCppRd, 2, "\n", 1); 1592 1593 assert(cbTodo >= 2); 1594 cbTodo -= 2; 1595 pszCur += 2; 1596 1597 fEmptyLine = 1; 1583 1598 continue; 1584 1599 } … … 1603 1618 cch = pszEol - pszCur; 1604 1619 1605 pszCur = kOCCppRdOptFlush(pCppRd, pszCur, 0); 1606 1620 pszCur += kOCCppRdOptFlush(pCppRd, pCppRd->offSrcCur, 0); 1621 1622 assert(cch <= cbTodo); 1607 1623 cbTodo -= cch; 1608 1624 pszCur += cch; … … 1619 1635 { 1620 1636 pCppRd->fDone = 1; 1621 assert(pCppRd->off Read < 1 || pCppRd->pszBuf[pCppRd->offRead - 1] != '\0');1622 pCppRd->pszBuf[pCppRd->off Read] = '\0';1637 assert(pCppRd->offSrcRead < 1 || pCppRd->pszBuf[pCppRd->offSrcRead - 1] != '\0'); 1638 pCppRd->pszBuf[pCppRd->offSrcRead] = '\0'; 1623 1639 kOCCppRdOpt(pCppRd); 1624 kOCCppRdOptFlush(pCppRd, pCppRd->pszBuf + pCppRd->offCur, 0); 1640 1641 assert(pCppRd->offSrcCur == pCppRd->offSrcRead); 1642 kOCCppRdOptFlush(pCppRd, pCppRd->offSrcCur, 0); 1625 1643 } 1626 1644 … … 1650 1668 * Optimize the C preprocessor output on the way thru. 1651 1669 */ 1652 size_t const cchOldOptimized = pCppRd->cch Optimized;1670 size_t const cchOldOptimized = pCppRd->cchDstOptimized; 1653 1671 if (pCppRd->chSaved) 1654 pCppRd->pszBuf[pCppRd->cch Optimized] = pCppRd->chSaved;1672 pCppRd->pszBuf[pCppRd->cchDstOptimized] = pCppRd->chSaved; 1655 1673 1656 1674 do 1657 1675 { 1658 1676 /* Read more raw C preprocessor output. */ 1659 cbLeft = pCppRd->cbBufAlloc - pCppRd->off Read;1677 cbLeft = pCppRd->cbBufAlloc - pCppRd->offSrcRead; 1660 1678 if (cbLeft <= 1) 1661 1679 cbLeft = kOCCppRdGrowBuffer(pCppRd); 1662 if (cbLeft > 256*1024)1663 cbLeft = 256*1024; /* memmove() get's expensive if there is to much to work on - bad algorithm! */1664 1680 1665 1681 do 1666 cbRead = read(fdIn, pCppRd->pszBuf + pCppRd->off Read, (long)(cbLeft - 1));1682 cbRead = read(fdIn, pCppRd->pszBuf + pCppRd->offSrcRead, (long)(cbLeft - 1)); 1667 1683 while (cbRead < 0 && errno == EINTR); 1668 1684 if (cbRead < 0) 1669 1685 FatalDie("kOCCppRdRead - read(%d,,%ld) failed: %s\n", 1670 1686 fdIn, (long)(cbLeft - 1), strerror(errno)); 1671 pCppRd->off Read += cbRead;1687 pCppRd->offSrcRead += cbRead; 1672 1688 1673 1689 /* Optimize it. */ … … 1678 1694 } 1679 1695 kOCCppRdOpt(pCppRd); 1680 } while (pCppRd->cch Optimized == cchOldOptimized);1696 } while (pCppRd->cchDstOptimized == cchOldOptimized); 1681 1697 1682 1698 *ppszRet = &pCppRd->pszBuf[cchOldOptimized]; 1683 pCppRd->chSaved = pCppRd->pszBuf[pCppRd->cch Optimized];1684 pCppRd->pszBuf[pCppRd->cch Optimized] = '\0';1685 cbRead = (long)(pCppRd->cch Optimized - cchOldOptimized);1699 pCppRd->chSaved = pCppRd->pszBuf[pCppRd->cchDstOptimized]; 1700 pCppRd->pszBuf[pCppRd->cchDstOptimized] = '\0'; 1701 cbRead = (long)(pCppRd->cchDstOptimized - cchOldOptimized); 1686 1702 } 1687 1703 else … … 1691 1707 */ 1692 1708 char *pszBuf; 1693 cbLeft = pCppRd->cbBufAlloc - pCppRd->off Read;1709 cbLeft = pCppRd->cbBufAlloc - pCppRd->offSrcRead; 1694 1710 if (cbLeft <= 1) 1695 1711 cbLeft = kOCCppRdGrowBuffer(pCppRd); 1696 pszBuf = pCppRd->pszBuf + pCppRd->off Read;1712 pszBuf = pCppRd->pszBuf + pCppRd->offSrcRead; 1697 1713 1698 1714 do … … 1704 1720 1705 1721 *ppszRet = pszBuf; 1706 pCppRd->off Read += cbRead;1722 pCppRd->offSrcRead += cbRead; 1707 1723 pszBuf[cbRead] = '\0'; 1708 1724 } … … 1721 1737 static void kOCCppRdGrabOutput(PKOCCPPRD pCppRd, char **ppszRet, size_t *pcbRet) 1722 1738 { 1723 assert(pCppRd->off Read < 1 || pCppRd->pszBuf[pCppRd->offRead - 1] != '\0');1739 assert(pCppRd->offSrcRead < 1 || pCppRd->pszBuf[pCppRd->offSrcRead - 1] != '\0'); 1724 1740 *ppszRet = pCppRd->pszBuf; 1725 *pcbRet = pCppRd-> offRead;1741 *pcbRet = pCppRd->fOptimize ? pCppRd->cchDstOptimized : pCppRd->offSrcRead; 1726 1742 pCppRd->pszBuf = NULL; 1727 pCppRd->off Read = 0;1743 pCppRd->offSrcRead = 0; 1728 1744 } 1729 1745 … … 2962 2978 FatalDie("%s - _open_osfhandle failed: %d\n", pszMsg, strerror(errno)); 2963 2979 } 2964 else if ( _pipe(paFDs, 256*1024, _O_NOINHERIT | (fText ? _O_ BINARY : _O_TEXT)) < 02965 && _pipe(paFDs, 0, _O_NOINHERIT | (fText ? _O_ BINARY : _O_TEXT)) < 0)2980 else if ( _pipe(paFDs, 256*1024, _O_NOINHERIT | (fText ? _O_TEXT : _O_BINARY)) < 0 2981 && _pipe(paFDs, 0, _O_NOINHERIT | (fText ? _O_TEXT : _O_BINARY)) < 0) 2966 2982 #else 2967 2983 if (pipe(paFDs) < 0) … … 3128 3144 3129 3145 kOCSumInitWithCtx(&pEntry->New.SumHead, &Ctx); 3130 kOCCppRdInit(&CppRd, pEntry->Old.cbCpp, pEntry->fOptimizeCpp); 3146 kOCCppRdInit(&CppRd, pEntry->Old.cbCpp, pEntry->fOptimizeCpp, 3147 pEntry->pszMakeDepFilename ? &pEntry->DepState : NULL); 3131 3148 3132 3149 for (;;) … … 3144 3161 */ 3145 3162 kOCSumUpdate(&pEntry->New.SumHead, &Ctx, psz, cbRead); 3146 if (pEntry->pszMakeDepFilename )3163 if (pEntry->pszMakeDepFilename && !pEntry->fOptimizeCpp) 3147 3164 kOCDepConsumer(&pEntry->DepState, psz, cbRead); 3148 3165 } … … 3382 3399 3383 3400 kOCSumInitWithCtx(&pEntry->New.SumHead, &Ctx); 3384 kOCCppRdInit(&CppRd, pEntry->Old.cbCpp, pEntry->fOptimizeCpp); 3401 kOCCppRdInit(&CppRd, pEntry->Old.cbCpp, pEntry->fOptimizeCpp, 3402 pEntry->pszMakeDepFilename ? &pEntry->DepState : NULL); 3385 3403 InfoMsg(3, "preprocessor|compile - starting passhtru...\n"); 3386 3404 for (;;) … … 3399 3417 */ 3400 3418 kOCSumUpdate(&pEntry->New.SumHead, &Ctx, psz, cbRead); 3401 if (pEntry->pszMakeDepFilename )3419 if (pEntry->pszMakeDepFilename && !pEntry->fOptimizeCpp) 3402 3420 kOCDepConsumer(&pEntry->DepState, psz, cbRead); 3403 3421
Note:
See TracChangeset
for help on using the changeset viewer.