VirtualBox

Changeset 76555 in vbox for trunk/src/bldprogs/scmrw.cpp


Ignore:
Timestamp:
Jan 1, 2019 2:08:55 AM (6 years ago)
Author:
vboxsync
Message:

scm: made header guard #endif massaging configurable and for the time being optional.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bldprogs/scmrw.cpp

    r76554 r76555  
    31283128     * right kind of comment following it.
    31293129     */
    3130 #if 0
    3131     if (iEndIfOut == 0)
    3132         return ScmError(pState, VERR_PARSE_ERROR, "Expected '#endif' at the end of the file...\n");
    3133     rc = ScmStreamSeekByLine(pIn, iEndIfIn);
    3134     if (RT_FAILURE(rc))
    3135         return false;
    3136     rc = ScmStreamSeekByLine(pOut, iEndIfOut);
    3137     if (RT_FAILURE(rc))
    3138         return false;
    3139 
    3140     pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol);
    3141     if (!pchLine)
    3142         return ScmError(pState, VERR_INTERNAL_ERROR, "ScmStreamGetLine failed re-reading #endif!\n");
    3143 
    3144     char   szTmp[64 + sizeof(szNormalized)];
    3145     size_t cchTmp;
    3146     if (pSettings->fEndifGuardComment)
    3147         cchTmp = RTStrPrintf(szTmp, sizeof(szTmp), "#endif /* !%.*s */", Guard.cch, Guard.psz);
    3148     else
    3149         cchTmp = RTStrPrintf(szTmp, sizeof(szTmp), "#endif"); /* lazy bird */
    3150     fRet |= cchTmp != cchLine || memcmp(szTmp, pchLine, cchTmp) != 0;
    3151     rc = ScmStreamPutLine(pOut, szTmp, cchTmp, enmEol);
    3152     if (RT_FAILURE(rc))
    3153         return false;
    3154 
    3155     /* Copy out the remaining lines (assumes no #pragma once here). */
    3156     while ((pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol)) != NULL)
    3157     {
    3158         rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
     3130    if (pSettings->fFixHeaderGuardEndif)
     3131    {
     3132        if (iEndIfOut == 0)
     3133            return ScmError(pState, VERR_PARSE_ERROR, "Expected '#endif' at the end of the file...\n");
     3134        rc = ScmStreamSeekByLine(pIn, iEndIfIn);
    31593135        if (RT_FAILURE(rc))
    31603136            return false;
    3161     }
    3162 #else
    3163     RT_NOREF(iEndIfOut, iEndIfIn);
    3164 #endif
     3137        rc = ScmStreamSeekByLine(pOut, iEndIfOut);
     3138        if (RT_FAILURE(rc))
     3139            return false;
     3140
     3141        pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol);
     3142        if (!pchLine)
     3143            return ScmError(pState, VERR_INTERNAL_ERROR, "ScmStreamGetLine failed re-reading #endif!\n");
     3144
     3145        char   szTmp[64 + sizeof(szNormalized)];
     3146        size_t cchTmp;
     3147        if (pSettings->fEndifGuardComment)
     3148            cchTmp = RTStrPrintf(szTmp, sizeof(szTmp), "#endif /* !%.*s */", Guard.cch, Guard.psz);
     3149        else
     3150            cchTmp = RTStrPrintf(szTmp, sizeof(szTmp), "#endif"); /* lazy bird */
     3151        fRet |= cchTmp != cchLine || memcmp(szTmp, pchLine, cchTmp) != 0;
     3152        rc = ScmStreamPutLine(pOut, szTmp, cchTmp, enmEol);
     3153        if (RT_FAILURE(rc))
     3154            return false;
     3155
     3156        /* Copy out the remaining lines (assumes no #pragma once here). */
     3157        while ((pchLine = ScmStreamGetLine(pIn, &cchLine, &enmEol)) != NULL)
     3158        {
     3159            rc = ScmStreamPutLine(pOut, pchLine, cchLine, enmEol);
     3160            if (RT_FAILURE(rc))
     3161                return false;
     3162        }
     3163    }
    31653164
    31663165    return fRet;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette