AI review of 2026-10-19_14-45-22-7b8c53c3b3e5-results.txt PR: #8947 https://github.com/cppcheck-opensource/cppcheck/pull/8947 Tested: 7b8c53c3b3e54fccc9835b8d915ed390a6c3d823 Merge base: b2d83612a1d235901d70a77d25c21759014e4919 Reviewed: 2026-10-20 15:16:10 UTC Model: claude-opus-5-5 (effort high) Results: 17 reviewed of 17 in the report Verdicts: 17 improvement Tokens: 28759 input, 38688 cache read, 2418 cache write, 5427 output The verdicts are written by AI and can be wrong. ---- 1 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/a/audacity/audacity_4.0.1+dfsg.orig.tar.xz Result: main audacity-4.0.1/au3/libraries/au3-menus/MenuRegistry.h:78:39: style: Argument 'key' shadows outer variable [shadowVariable] audacity-4.0.1/au3/libraries/au3-menus/CommandManager.cpp:105:66: note: Shadowed variable audacity-4.0.1/au3/libraries/au3-menus/MenuRegistry.h:78:39: note: Shadow argument Explanation: The 'shadowed' variable is a global 'key' declared at CommandManager.cpp:105, after MenuRegistry.h has been included. The argument 'key' in the inline member function at header line 78 comes earlier in the translation unit. At that point the global is not yet declared, so nothing is shadowed. The PR now skips global-scope variables that are declared after the shadowing variable, so this false positive is correctly removed. ---- 2 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/a/audacity/audacity_4.0.1+dfsg.orig.tar.xz Result: main audacity-4.0.1/src/au3cloud/internal/au3cloudprojectfileioextension.cpp:51:40: style: Local variable 'extension' shadows outer variable [shadowVariable] audacity-4.0.1/src/au3cloud/internal/au3cloudprojectfileioextension.cpp:55:43: note: Shadowed variable audacity-4.0.1/src/au3cloud/internal/au3cloudprojectfileioextension.cpp:51:40: note: Shadow local variable Explanation: The local static 'extension' is declared on line 51, inside GetExtension(). The global 'extension' is declared later, on line 55. At line 51 the global is not yet visible, so nothing is shadowed and the old warning was a false positive. The PR now skips global variables declared after the local one, which removes this false positive. This matches the new test case for #15114. ---- 3 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/djview4/djview4_4.12.3.orig.tar.xz Result: main djview4-4.12.3/nsdejavu/nsdejavu.c:2035:31: style: Argument 'npclass' shadows outer variable [shadowVariable] djview4-4.12.3/nsdejavu/nsdejavu.c:2245:16: note: Shadowed variable djview4-4.12.3/nsdejavu/nsdejavu.c:2035:31: note: Shadow argument Explanation: The function argument 'npclass' at line 2035 was reported as shadowing a global variable declared later, at line 2245. In C, a global declared after the function is not in scope inside it, so nothing is shadowed and the warning was a false positive. The PR now skips global variables declared after the shadowing variable, which removes this false positive. ---- 4 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/dpf-plugins/dpf-plugins_1.7+ds1.orig.tar.xz Result: main DPF-Plugins-1.7/plugins/ProM/projectM/src/museum/projectM-xmms/sdltoprojectM.h:28:38: style: Argument 'event' shadows outer variable [shadowVariable] DPF-Plugins-1.7/plugins/ProM/projectM/src/museum/projectM-xmms/main.cpp:99:11: note: Shadowed variable DPF-Plugins-1.7/plugins/ProM/projectM/src/museum/projectM-xmms/sdltoprojectM.h:28:38: note: Shadow argument Explanation: The parameter 'event' of sdl2pmEvent() in sdltoprojectM.h was reported as shadowing a variable at main.cpp:99. That variable can only be a global, because a local in another function cannot be shadowed. The header is included near the top of main.cpp, so the global 'event' is declared after this function. At the point of the parameter it is not yet visible, so nothing is shadowed. The old code never applied any declaration-order check to global-scope variables. The PR now compares token order for global scope too, which removes this false positive. ---- 5 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/f/firebird3.0/firebird3.0_3.0.14.ds7.orig.tar.xz Result: main Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:332:20: style: Local variable 't' shadows outer variable [shadowVariable] Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:642:9: note: Shadowed variable Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:332:20: note: Shadow local variable Explanation: The local iterator 't' at line 332 is reported as shadowing a variable 't' declared at line 642, which is later in the file. That variable is in a non-executable outer scope, which given this PR's change must be the global scope. A global declared after the function is not visible at line 332, so nothing is shadowed and the warning was a false positive. The PR now skips global variables declared after the local one (#15114), which removes this false positive. ---- 6 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/f/firebird3.0/firebird3.0_3.0.14.ds7.orig.tar.xz Result: main Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:372:29: style: Local variable 't' shadows outer variable [shadowVariable] Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:642:9: note: Shadowed variable Firebird-3.0.14.33856-0/src/common/classes/misc/string_test.cpp:372:29: note: Shadow local variable Explanation: The local 't' at line 372 is declared inside a function body. The supposedly shadowed 't' is at line 642, after it. That later variable is likely a global or one in an enclosing non-executable scope. A variable declared later in the file cannot be shadowed by an earlier local. Main only skipped later declarations in executable scopes. The PR now also skips later declarations in the global scope, so this false positive is removed. ---- 7 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gdcm/gdcm_3.0.24.orig.tar.xz Result: main gdcm-3.0.24/Applications/Cxx/gdcmxml.cxx:58:64: style: Argument 'ts' shadows outer variable [shadowVariable] gdcm-3.0.24/Applications/Cxx/gdcmxml.cxx:80:16: note: Shadowed variable gdcm-3.0.24/Applications/Cxx/gdcmxml.cxx:58:64: note: Shadow argument Explanation: The function argument 'ts' at line 58 belongs to a member function defined inline in a class. The global 'TransferSyntax ts' is declared later, at line 80. When the class is parsed, that global is not yet declared, so the argument shadows nothing. The PR now skips global-scope variables declared after the shadowing variable, which removes this false positive. ---- 8 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/glvis/glvis_4.5.orig.tar.gz Result: main glvis-4.5/lib/aux_vis.hpp:163:6: style: Local variable 'input' shadows outer variable [shadowVariable] glvis-4.5/glvis.cpp:66:5: note: Shadowed variable glvis-4.5/lib/aux_vis.hpp:163:6: note: Shadow local variable Explanation: The template function `prompt` in aux_vis.hpp declares a local `input`. The global `input` at glvis.cpp:66 is declared after that header is included, so it is not in scope at that point and nothing is shadowed. The old check compared only line numbers across different files (66 < 163), which produced this false positive. The new check uses token order, so it correctly skips a global declared later. ---- 9 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/magics++/magics++_4.17.0.orig.tar.gz Result: main magics-4.17.0/src/decoders/GribDecoder.cc:1675:12: style: Local variable 'proj' shadows outer variable [shadowVariable] magics-4.17.0/src/decoders/GribDecoder.cc:2642:64: note: Shadowed variable magics-4.17.0/src/decoders/GribDecoder.cc:1675:12: note: Shadow local variable Explanation: The local `string proj` in `GribDecoder::representation()` is at line 1675. The supposedly shadowed variable is declared much later, at line 2642, in an outer (global/namespace) scope. A variable declared later in the file is not visible at line 1675, so nothing is shadowed. The PR now skips global-scope variables declared after the shadowing variable (the #15114 fix), which removes this false positive. ---- 10 / 17 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/m/magics++/magics++_4.17.0.orig.tar.gz Result: main magics-4.17.0/src/decoders/ThinningMethod.cc:47:44: style: Argument 'data' shadows outer variable [shadowVariable] magics-4.17.0/src/decoders/ThinningMethod.cc:92:63: note: Shadowed variable magics-4.17.0/src/decoders/ThinningMethod.cc:47:44: note: Shadow argument Explanation: The reported 'shadowed' variable is declared at line 92, after the operator() definition at line 47, in the same .cc file. It is most likely a later global-scope declaration rather than a class member (members would normally live in the header). A global declared later is not visible at line 47, so the parameter 'data' cannot shadow it. The PR now skips later declarations in global scope, which removes this false positive. ---- 11 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/magics++/magics++_4.17.0.orig.tar.gz Result: main magics-4.17.0/src/decoders/ThinningMethod.cc:59:48: style: Argument 'data' shadows outer variable [shadowVariable] magics-4.17.0/src/decoders/ThinningMethod.cc:92:63: note: Shadowed variable magics-4.17.0/src/decoders/ThinningMethod.cc:59:48: note: Shadow argument Explanation: The global 'data' object is declared at line 92, after the operator() definition at line 59. At the point of the argument declaration that global is not in scope, so the argument shadows nothing. The PR now skips global-scope variables declared after the shadowing variable, which removes this false positive. ---- 12 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mangohud/mangohud_0.8.4+dfsg.orig.tar.xz Result: main MangoHud-v0.8.4/src/overlay.h:106:9: style: Local variable 'params' shadows outer variable [shadowVariable] MangoHud-v0.8.4/src/app/main.cpp:38:16: note: Shadowed variable MangoHud-v0.8.4/src/overlay.h:106:9: note: Shadow local variable Explanation: overlay.h is included by main.cpp, and main.cpp declares its global 'params' at line 38, after that include. The old code compared line numbers across different files, so it treated the later global as declared earlier and reported shadowing. A local variable cannot shadow a global that is declared later in the translation unit, so the warning was a false positive. The PR uses token order instead, which removes it. ---- 13 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mangohud/mangohud_0.8.4+dfsg.orig.tar.xz Result: main MangoHud-v0.8.4/src/overlay.h:106:9: style: Local variable 'params' shadows outer variable [shadowVariable] MangoHud-v0.8.4/src/win/d3d_shared.h:6:30: note: Shadowed variable MangoHud-v0.8.4/src/overlay.h:106:9: note: Shadow local variable Explanation: The local `params` in the inline function `engine_name()` in overlay.h (line 106) was reported as shadowing a global declared at d3d_shared.h:6. That header almost certainly includes overlay.h first, so its global comes after `engine_name()` in the translation unit. A global declared later is not in scope inside the earlier function body, so nothing is shadowed and the warning was a false positive. Main flagged it only because it compared line numbers across different files (6 < 106). The PR compares token order instead, which correctly removes this false positive. ---- 14 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mangohud/mangohud_0.8.4+dfsg.orig.tar.xz Result: main MangoHud-v0.8.4/src/overlay.h:95:55: style: Argument 'sw_stats' shadows outer variable [shadowVariable] MangoHud-v0.8.4/src/app/main.cpp:37:17: note: Shadowed variable MangoHud-v0.8.4/src/overlay.h:95:55: note: Shadow argument Explanation: The function `engine_name(const swapchain_stats& sw_stats)` is defined inline in overlay.h. main.cpp includes that header near the top and only later, at line 37, declares a global `sw_stats`. So at the point where the parameter is declared, the global does not exist yet, and the parameter cannot shadow it. The old check compared line numbers across different files: 37 < 95, so it wrongly treated the global as declared earlier. The PR compares token order with `succeeds()` and now correctly skips this later global. A false positive was removed. ---- 15 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mangohud/mangohud_0.8.4+dfsg.orig.tar.xz Result: main MangoHud-v0.8.4/src/overlay.h:95:55: style: Argument 'sw_stats' shadows outer variable [shadowVariable] MangoHud-v0.8.4/src/win/d3d_shared.h:7:31: note: Shadowed variable MangoHud-v0.8.4/src/overlay.h:95:55: note: Shadow argument Explanation: The parameter `sw_stats` in `engine_name()` (overlay.h:95) was reported as shadowing the global `sw_stats` declared in d3d_shared.h:7. d3d_shared.h most likely includes overlay.h before that declaration, so the global comes later in the token stream. At the point of the inline function, that global is not in scope and nothing is shadowed. The old check compared line numbers only inside executable scopes and never skipped later globals. The PR now skips global variables that come after the shadowing variable in token order, which removes this false positive. ---- 16 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/n/nestopia/nestopia_2.0.0+dfsg.orig.tar.xz Result: main nestopia-2.0.0-27246144887c78154584515f530c61497e92cd05/nes_ntsc/demo_impl.h:149:58: style: Argument 'palette' shadows outer variable [shadowVariable] nestopia-2.0.0-27246144887c78154584515f530c61497e92cd05/nes_ntsc/demo.c:20:18: note: Shadowed variable nestopia-2.0.0-27246144887c78154584515f530c61497e92cd05/nes_ntsc/demo_impl.h:149:58: note: Shadow argument Explanation: The shadowed global `palette` is at demo.c:20:18, which matches `static SDL_Color palette [256];`. In nes_ntsc's demo.c that declaration comes after `#include "demo_impl.h"`. In token order, `load_bmp`'s parameter `palette` is therefore declared before the global exists, so nothing is shadowed at that point. The old check compared only line numbers across files: line 149 in the header against line 20 in demo.c. That wrongly treated the later global as an earlier declaration. The PR compares token order instead (`succeeds`) and now skips globals declared later, as in #15114. Removing this false positive is correct. ---- 17 / 17 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/o/olm/olm_3.2.16+dfsg.orig.tar.xz Result: main olm-3.2.16/lib/curve25519-donna/test-curve25519.c:15:61: style: Argument 'k' shadows outer variable [shadowVariable] olm-3.2.16/lib/curve25519-donna/test-curve25519.c:31:15: note: Shadowed variable olm-3.2.16/lib/curve25519-donna/test-curve25519.c:15:61: note: Shadow argument Explanation: The parameter 'k' of doit() is declared on line 15. The global 'k' is declared later, on line 31. At the point of doit's definition the global is not yet visible, so nothing is shadowed. The PR now skips later declarations in global scope too, which removes this false positive. This matches the new test case #15114.