Changeset 98387 in vbox
- Timestamp:
- Feb 1, 2023 1:18:32 PM (20 months ago)
- File:
-
- 1 edited
-
trunk/src/bldprogs/scmrw-kmk.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/scmrw-kmk.cpp
r98383 r98387 312 312 } 313 313 } 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 */ 329 static 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; 314 348 } 315 349 … … 717 751 } 718 752 /* '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"))) 720 755 return scmKmkGiveUp(pParser, "Right set cannot be empty for '%.*s'", cchToken, &pchLine[offToken]); 721 756 offSrc++;
Note:
See TracChangeset
for help on using the changeset viewer.

