Skip to content
  • Michał Kępień's avatar
    Work around cppcheck 2.0 uninitvar false positives · 41b4af5d
    Michał Kępień authored
    cppcheck 2.0 reports false positives about uninitialized variables in a
    lot of places throughout BIND source code, e.g.:
    
        bin/dig/host.c:386:24: error: Uninitialized variable: length [uninitvar]
         printf("%.*s", (int)r.length, (char *)r.base);
                               ^
    
    Apparently cppcheck 2.0 has issues with processing (&var)->field syntax,
    which is what the macros from lib/isc/include/isc/buffer.h are evaluated
    to.  This issue was reported upstream [1] and will hopefully be
    addressed in a future cppcheck release.
    
    In the meantime, to avoid modifying BIND source code in multiple places
    just because of a static checker false positive, work around the issue
    by adding intermediate variables to buffer macro definitions using a sed
    invocation in the cppcheck job script.
    
    [1] https://sourceforge.net/p/cppcheck/discussion/general/thread/122153e3c1/
    
    (cherry picked from commit 481fa34e)
    41b4af5d
Validating GitLab CI configuration… Learn more