VirtualBox

Changeset 98387 in vbox


Ignore:
Timestamp:
Feb 1, 2023 1:18:32 PM (20 months ago)
Author:
vboxsync
Message:

scm: More on the kmk makefile cleanup. bugref:10348

File:
1 edited

Legend:

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

    r98383 r98387  
    312312        }
    313313    }
     314}
     315
     316
     317/**
     318 * Checks if the given line contains a comment with the @a pszMarker word in it.
     319 *
     320 * This can be used to disable warnings.
     321 *
     322 * @returns true if this is the case, false if not
     323 * @param   pchLine     The line.
     324 * @param   cchLine     The line length.
     325 * @param   offLine     The current line position, 0 if uncertain.
     326 * @param   pszMarker   The marker to check for.
     327 * @param   cchMarker   The length of the marker string.
     328 */
     329static bool scmKmkHasCommentMarker(const char *pchLine, size_t cchLine, size_t offLine, const char *pszMarker, size_t cchMarker)
     330{
     331    const char *pchCur = (const char *)memchr(&pchLine[offLine], '#', cchLine - RT_MIN(offLine, cchLine));
     332    if (pchCur)
     333    {
     334        pchCur++;
     335        size_t cchLeft = (size_t)(&pchLine[cchLine] - pchCur);
     336        while (cchLeft >= cchMarker)
     337        {
     338            const char *pchHit = (char *)memchr(pchCur, *pszMarker, cchLeft - cchMarker + 1);
     339            if (!pchHit)
     340                break;
     341            if (memcmp(pchHit, pszMarker, cchMarker) == 0)
     342                return true;
     343            pchCur  = pchHit + 1;
     344            cchLeft = (size_t)(&pchLine[cchLine] - pchCur);
     345        }
     346    }
     347    return false;
    314348}
    315349
     
    717751    }
    718752    /* 'if1of(stuff, )' does not make sense in committed code: */
    719     else if (enmToken == kKmkToken_if1of || enmToken == kKmkToken_ifn1of)
     753    else if (   (enmToken == kKmkToken_if1of || enmToken == kKmkToken_ifn1of)
     754             && !scmKmkHasCommentMarker(pchLine, cchLine, offSrc, RT_STR_TUPLE("scm:ignore-empty-if1of-set")))
    720755        return scmKmkGiveUp(pParser, "Right set cannot be empty for '%.*s'", cchToken, &pchLine[offToken]);
    721756    offSrc++;
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