• Clemens Hammacher's avatar
    [presubmit] Add check for unbalanced #define / #undef · b8cc63ee
    Clemens Hammacher authored
    With jumbo builds, we get spurious errors if several .cc files define
    the same preprocessor macro without undefining it. This is also
    disallowed by the style guide.
    This patch adds a presubmit check to check that each #define is
    eventually followed by a corresponding #undef. Special care has to be
    taken for conditionally defined macros. Here, the logic to check that
    there are not multiple defines and that they are undefined in all
    cases is not perfect; it's optimistic in order to avoid false positives.
    
    R=mstarzinger@chromium.org, machenbach@chromium.org
    
    Bug: v8:6811
    Change-Id: I55cde499399d97a5eb02fbc5ecfa34e6a8099d06
    Reviewed-on: https://chromium-review.googlesource.com/657104
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
    Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#47944}
    b8cc63ee
PRESUBMIT.py 15.7 KB