Changeset 57002 in vbox for trunk/src/bldprogs
- Timestamp:
- Jul 18, 2015 11:44:13 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101717
- Location:
- trunk/src/bldprogs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/VBoxCompilerPlugIns.h
r56977 r57002 62 62 * Implements checking format string replacement (%M). 63 63 * 64 * Caller will have checked all that can be checked. 64 * Caller will have checked all that can be checked. This means that there is a 65 * string argument present, or it won't make the call. 65 66 * 66 67 * @param pState The format string checking state. … … 80 81 */ 81 82 void VFmtChkWarnFmt(PVFMTCHKSTATE pState, const char *pszLoc, const char *pszFormat, ...); 83 84 /** 85 * Error. 86 * 87 * @returns 88 * @param pState . 89 * @param pszLoc . 90 * @param pszFormat . 91 * @param ... . 92 */ 93 void VFmtChkErrFmt(PVFMTCHKSTATE pState, const char *pszLoc, const char *pszFormat, ...); 82 94 83 95 /** -
trunk/src/bldprogs/VBoxCompilerPlugInsCommon.cpp
r56981 r57002 118 118 cchWidth = 0; 119 119 fFlags |= RTSTR_F_WIDTH; 120 ch = *pszFmt++; 120 121 } 121 122 … … 142 143 iArg++; 143 144 cchPrecision = 0; 145 ch = *pszFmt++; 144 146 } 145 147 else 146 VFmtChk WarnFmt(pState, pszPct, "Missing precision value, only got the '.'");148 VFmtChkErrFmt(pState, pszPct, "Missing precision value, only got the '.'"); 147 149 if (cchPrecision < 0) 148 150 { 149 VFmtChk WarnFmt(pState, pszPct, "Negative precision value: %d", cchPrecision);151 VFmtChkErrFmt(pState, pszPct, "Negative precision value: %d", cchPrecision); 150 152 cchPrecision = 0; 151 153 } … … 223 225 { 224 226 if (*pszFmt) 225 VFmtChk WarnFmt(pState, pszFmt, "Characters following '%%M' will be ignored");227 VFmtChkErrFmt(pState, pszFmt, "Characters following '%%M' will be ignored"); 226 228 if (chSize != '\0') 227 229 VFmtChkWarnFmt(pState, pszFmt, "'%%M' does not support any size flags (%c)", chSize); -
trunk/src/bldprogs/VBoxCompilerPlugInsGcc.cpp
r56977 r57002 617 617 618 618 619 void VFmtChkErrFmt(PVFMTCHKSTATE pState, const char *pszLoc, const char *pszFormat, ...) 620 { 621 char szTmp[1024]; 622 va_list va; 623 va_start(va, pszFormat); 624 vsnprintf(szTmp, sizeof(szTmp), pszFormat, va); 625 va_end(va); 626 627 /* display the warning. */ 628 error_at(MyGetFormatStringLocation(pState, pszLoc), "%s", szTmp); 629 } 630 631 619 632 620 633 void VFmtChkVerifyEndOfArgs(PVFMTCHKSTATE pState, unsigned iArg) … … 631 644 tree hArg = gimple_call_arg(pState->hStmt, iArg); 632 645 if (cArgs - iArg > 1) 633 warning_at(MY_LOC(hArg, pState), 0, "%u extra arguments not consumed by format string", cArgs - iArg);646 error_at(MY_LOC(hArg, pState), "%u extra arguments not consumed by format string", cArgs - iArg); 634 647 else if ( TREE_CODE(hArg) != INTEGER_CST 635 648 || !TREE_INT_CST(hArg).fits_shwi() 636 649 || TREE_INT_CST(hArg).to_shwi() != -99) /* ignore final dummy argument: ..., -99); */ 637 warning_at(MY_LOC(hArg, pState), 0, "one extra argument not consumed by format string");650 error_at(MY_LOC(hArg, pState), "one extra argument not consumed by format string"); 638 651 } 639 652 /* This should be handled elsewhere, but just in case. */ 640 653 else if (iArg - 1 == cArgs) 641 warning_at(pState->hFmtLoc, 0, "one argument too few");654 error_at(pState->hFmtLoc, "one argument too few"); 642 655 else 643 warning_at(pState->hFmtLoc, 0, "%u arguments too few", iArg - cArgs);656 error_at(pState->hFmtLoc, "%u arguments too few", iArg - cArgs); 644 657 } 645 658 } … … 654 667 if (iArg >= cArgs) 655 668 { 656 VFmtChk WarnFmt(pState, pszLoc, "Missing argument! %s", pszMessage);669 VFmtChkErrFmt(pState, pszLoc, "Missing argument! %s", pszMessage); 657 670 return false; 658 671 } … … 695 708 696 709 697 698 710 void VFmtChkHandleReplacementFormatString(PVFMTCHKSTATE pState, const char *pszPctM, unsigned iArg) 699 711 { 700 712 if (pState->iArgs > 0) 701 713 { 702 pState->iArgs += iArg; 703 714 pState->iFmt = pState->iArgs + iArg; 715 pState->iArgs = pState->iFmt + 1; 716 MyCheckFormatRecursive(pState, gimple_call_arg(pState->hStmt, pState->iFmt - 1)); 704 717 } 705 718 }
Note:
See TracChangeset
for help on using the changeset viewer.