VirtualBox

Changeset 94913 in vbox


Ignore:
Timestamp:
May 8, 2022 7:07:29 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
151321
Message:

scm: New heuristic to trigger only on 'HRESULT rc' and 'int rc' declarations as the other one was too broad and triggered on things which we don't want it to trigger on, bugref:10223

File:
1 edited

Legend:

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

    r94905 r94913  
    33913391        }
    33923392
     3393#if 0 /* This is too broad and triggers on things we don't want to trigger on (like autoCaller.rc()). */
    33933394        const RTSTRTUPLE RcTuple = { RT_STR_TUPLE("rc") };
    33943395        size_t const cchWord = RcTuple.cch;
     
    34153416            }
    34163417        }
     3418#else
     3419        /* Trigger on declarations of 'HRESULT rc' and 'int rc'. */
     3420        static const SCMMATCHWORD s_aHresultRc[] =
     3421        {
     3422            { RT_STR_TUPLE("HRESULT"),                  0, true, false },
     3423            { RT_STR_TUPLE("rc"),                       1, true, false }
     3424        };
     3425
     3426        static const SCMMATCHWORD s_aIntRc[] =
     3427        {
     3428            { RT_STR_TUPLE("int"),                      0, true, false },
     3429            { RT_STR_TUPLE("rc"),                       1, true, false }
     3430        };
     3431
     3432        rc = ScmMatchWords(pchLine, cchLine, s_aHresultRc, RT_ELEMENTS(s_aHresultRc),
     3433                           &offNext, NULL /*paIdentifiers*/, RTErrInfoInitStatic(&ErrInfo));
     3434        if (RT_SUCCESS(rc))
     3435        {
     3436            ScmFixManually(pState, "%u:%zu: 'HRESULT rc' is not allowed! Use 'HRESULT hrc' instead.\n",
     3437                           iLine, offNext);
     3438            continue;
     3439        }
     3440
     3441        rc = ScmMatchWords(pchLine, cchLine, s_aIntRc, RT_ELEMENTS(s_aIntRc),
     3442                           &offNext, NULL /*paIdentifiers*/, RTErrInfoInitStatic(&ErrInfo));
     3443        if (RT_SUCCESS(rc))
     3444        {
     3445            ScmFixManually(pState, "%u:%zu: 'int rc' is not allowed! Use 'int vrc' instead.\n",
     3446                           iLine, offNext);
     3447            continue;
     3448        }
     3449#endif
    34173450    }
    34183451
Note: See TracChangeset for help on using the changeset viewer.

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