AI review of 2026-10-16_13-14-47-007ab4b10a5a-results.txt PR: #8947 https://github.com/cppcheck-opensource/cppcheck/pull/8947 Tested: 007ab4b10a5a943e81adac9792a1afb05536675b Merge base: b2d83612a1d235901d70a77d25c21759014e4919 Reviewed: 2026-10-16 19:57:53 UTC Model: claude-opus-5-5 (effort high) Results: 50 reviewed of 160 in the report (random sample) Verdicts: 33 improvement, 2 neutral, 15 regression Tokens: 235282 input, 80556 cache read, 1644 cache write, 17778 output The verdicts are written by AI and can be wrong. ---- 1 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/a/ace/ace_8.0.5+dfsg.orig.tar.gz Result: main ace-8.0.5+dfsg.orig/tests/Bug_3911_Regression_Test.cpp:89:36: style: Argument 'block_name' shadows outer variable [shadowVariable] ace-8.0.5+dfsg.orig/tests/Bug_3911_Regression_Test.cpp:135:13: note: Shadowed variable ace-8.0.5+dfsg.orig/tests/Bug_3911_Regression_Test.cpp:89:36: note: Shadow argument Explanation: The warning is reported against a variable declared at line 135, after the member function defined at line 89. The PR only adds a line-number check for global scope, so the removed warning must involve a global declared after the function. A global declared later is not visible inside the earlier function body, so argument 'block_name' does not shadow it. The old warning was a false positive. ---- 2 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/lkcd_v2_v3.c:33:28: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/lkcd_v2_v3.c:33:28: note: Shadow argument Explanation: defs.h line 5443 declares the global `fp`, and defs.h is included at line 19 of lkcd_v2_v3.c, before the function at line 33. So the argument `fp` really does shadow that global, and the old warning was a true positive. The PR now skips global-scope variables whose line number is greater than the shadowing variable's line number, but it compares line numbers across different files (5443 in defs.h vs 33 in the .c file). That wrongly drops this valid warning. ---- 3 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/lkcd_v5.c:31:25: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/lkcd_v5.c:31:25: note: Shadow argument Explanation: The shadowed 'fp' is a global declared in defs.h:5443, which lkcd_v5.c includes at line 19, before the function at line 31. So argument 'fp' really does shadow the global, and the warning was a true positive. The PR now skips global-scope variables whose line number is greater than the shadowing line, but it compares line numbers across different files (defs.h line 5443 vs lkcd_v5.c line 31). The header declaration is therefore wrongly treated as coming later, and the valid warning is lost. ---- 4 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/lkcd_v8.c:212:25: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/lkcd_v8.c:212:25: note: Shadow argument Explanation: The shadowed variable is the global `fp` declared in defs.h:5443 (crash declares `extern FILE *fp;` there). defs.h is included before lkcd_v8.c:212, so the argument `fp` really does shadow that global, and the warning was a true positive. The PR now skips global-scope variables whose line number is greater than the shadowing line, but it compares line numbers without checking the file. 5443 in defs.h is greater than 212 in lkcd_v8.c, so a declaration that comes earlier in the translation unit is wrongly treated as coming later. As a result the valid warning is dropped. ---- 5 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/netdump.c:4598:23: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/netdump.c:4598:23: note: Shadow argument Explanation: The global `fp` is declared at defs.h:5443, and defs.h is included at the top of netdump.c, so it is visible before `proc_kcore_init(FILE *fp, ...)` at netdump.c:4598. The parameter really does shadow the global, so the old warning was a true positive. The new check skips global variables whose line number is greater than the shadowing line, but it compares line numbers from different files. Because 5443 > 4598, the header declaration is wrongly treated as coming later. The same bug removes the other warnings in this package where the shadowed global is in defs.h. ---- 6 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:114:17: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:114:17: note: Shadow argument Explanation: `get_le16(FILE *fp)` takes a parameter named `fp`. That parameter shadows the global `fp` declared in defs.h:5443, which is included before qemu-load.c's functions, so the warning was a true positive. The PR now skips global variables whose declaration line number is greater than the shadowing line. Here it compares line 5443 in defs.h with line 114 in qemu-load.c, which ignores that they are different files. The global is wrongly treated as declared later and the valid warning is lost. ---- 7 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:235:40: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:235:40: note: Shadow argument Explanation: defs.h line 5443 declares a global `fp`. defs.h is included at the top of qemu-load.c, so the global is declared before the function parameter `FILE *fp` and really is shadowed. The warning was a true positive. The PR now skips globals whose `linenr()` is greater than the shadowing variable's line, but it compares line numbers across different files (defs.h:5443 vs qemu-load.c:235) without checking the file. Every removed warning in this package has a line number below 5443, which matches that bug. Valid shadowVariable warnings are lost because of a wrong comparison, not because Cppcheck understands the code better. ---- 8 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:364:49: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:364:49: note: Shadow argument Explanation: The shadowed variable is a global `fp` declared in defs.h:5443. defs.h is included at the top of qemu-load.c, so that global is visible before the function argument `fp`, and the argument really does shadow it. This is a true positive. The PR now skips global variables whose line number is greater than the shadowing line, but it compares line numbers across different files without checking the file index. Because 5443 (in defs.h) > 364 (in qemu-load.c), the header global is wrongly treated as declared later, and the valid warning is lost. ---- 9 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:442:21: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:442:21: note: Shadow argument Explanation: The global `fp` declared at defs.h:5443 is included before qemu-load.c, so the parameter `FILE *fp` of get_be_fp80 really shadows it. That is exactly what shadowVariable is meant to report, so the warning was a true positive. The PR now skips global variables whose declaration line number is greater than the shadowing line, but it compares line numbers without checking the file. 5443 (defs.h) > 442 (qemu-load.c), so the earlier declaration in the header is wrongly treated as declared later and ignored. This drops true positives across many functions in this file. ---- 10 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:451:27: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:451:27: note: Shadow argument Explanation: The shadowed variable is the global `fp` declared in defs.h:5443. defs.h is included before qemu-load.c's code, so the parameter `fp` of cpu_load_seg really does shadow that global, and the warning was a true positive. The PR now skips global-scope variables whose line number is greater than the shadowing variable's line, but it compares only line numbers and ignores which file each declaration is in. Header line 5443 is greater than 451, so the earlier global from the included header is wrongly treated as declared later. A valid warning is therefore lost. ---- 11 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:472:40: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:472:40: note: Shadow argument Explanation: defs.h declares a global `fp` (`extern FILE *fp;` at line 5443). qemu-load.c includes defs.h, so the global is visible before the function whose parameter `fp` is flagged, and the parameter really does shadow it. The PR now skips global variables whose line number is greater than the shadowing token's line number. It compares only line numbers and ignores which file each token is in, so 5443 > 472 makes it wrongly treat the global as declared later. That is why every qemu-load.c warning (all at lines below 5443) disappears. A true positive was lost. ---- 12 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/qemu-load.c:736:41: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/qemu-load.c:736:41: note: Shadow argument Explanation: The global 'fp' is declared in defs.h at line 5443. defs.h is included before qemu-load.c's functions, so the 'FILE *fp' parameters really do shadow it, and the main warning was a true positive. The PR now skips global-scope variables whose declaration line is greater than the shadowing line. It compares only line numbers and ignores which file each declaration is in. Because 5443 > 736, the earlier header declaration is treated as coming later, and the warning is wrongly dropped. That removes a true positive. ---- 13 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/sadump.c:924:30: style: Argument 'fp' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:5443:14: note: Shadowed variable crash-utility-crash-61fe107/sadump.c:924:30: note: Shadow argument Explanation: `defs.h` declares a global `FILE *fp` at line 5443 and is included before `sadump.c`, so the argument `fp` at `sadump.c:924` really shadows it. The original warning was a true positive. The PR skips global variables whose line number is greater than the shadowing variable's line, but it compares line numbers without checking that they come from the same file. Because 5443 > 924, the header declaration is wrongly treated as coming later and is skipped. The same mistake removes many other valid warnings in this package. ---- 14 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/crash/crash_9.0.2+~16.3.orig.tar.gz Result: main crash-utility-crash-61fe107/vmware_guestdump.c:130:24: style: Argument 'version' shadows outer variable [shadowVariable] crash-utility-crash-61fe107/defs.h:8095:14: note: Shadowed variable crash-utility-crash-61fe107/vmware_guestdump.c:130:24: note: Shadow argument Explanation: The global 'version' is declared in defs.h at line 8095. defs.h is included before vmware_guestdump.c line 130, so the parameter 'version' in get_gap2_size really does shadow an already visible global. The old warning was a true positive. The PR now skips global variables whose line number is greater than the shadowing line, but it compares line numbers without checking that both are in the same file. Line 8095 in defs.h is wrongly treated as coming after line 130 in the .c file, so the warning is lost. The same flaw removes many other true positives in this package, such as the 'fp' and 'argcnt' warnings that also point to defs.h. ---- 15 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/f/ferret-vis/ferret-vis_7.6.0.orig.tar.xz Result: main ferret-vis-7.6.0/xgks/progs/pmark.c:50:21: style: Argument 'ws_id' shadows outer variable [shadowVariable] ferret-vis-7.6.0/xgks/progs/pmark.c:71:17: note: Shadowed variable ferret-vis-7.6.0/xgks/progs/pmark.c:50:21: note: Shadow argument Explanation: The K&R-style parameter 'ws_id' of WaitForBreak (line 50) appears before the global 'ws_id' declared at line 71. At that point the global is not yet visible, so nothing is shadowed. The old warning was a false positive. The PR now skips global variables declared after the shadowing declaration, which removes it correctly. ---- 16 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/builtin/add.c:123:49: style: Argument 'verbose' shadows outer variable [shadowVariable] 21b8a5bc/builtin/add.c:235:12: note: Shadowed variable 21b8a5bc/builtin/add.c:123:49: note: Shadow argument Explanation: The function refresh() at line 123 takes a parameter 'verbose'. The global variable 'verbose' it was said to shadow is declared later, at line 235. At line 123 that global is not in scope, so no shadowing happens. The PR skips global variables declared after the line being checked, which removes this false positive. ---- 17 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/builtin/add.c:45:10: style: Argument 'show_only' shadows outer variable [shadowVariable] 21b8a5bc/builtin/add.c:235:21: note: Shadowed variable 21b8a5bc/builtin/add.c:45:10: note: Shadow argument Explanation: The function argument 'show_only' is declared at line 45. The global 'show_only' is declared later, at line 235. At line 45 the global is not yet in scope, so the argument cannot shadow it in C. The warning was a false positive. The PR now skips global variables declared after the shadowing declaration, which removes it. ---- 18 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/builtin/update-ref.c:174:18: style: Argument 'command' shadows outer variable [shadowVariable] 21b8a5bc/builtin/update-ref.c:679:3: note: Shadowed variable 21b8a5bc/builtin/update-ref.c:174:18: note: Shadow argument Explanation: The 'Shadowed variable' is the global array 'command' at line 679, which is declared after parse_next_oid() at line 174. At that point in the file the global is not yet in scope, so the parameter 'command' does not shadow anything. The PR now skips global variables declared after the shadowing line, which removes this false positive. ---- 19 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/builtin/update-ref.c:595:35: style: Argument 'command' shadows outer variable [shadowVariable] 21b8a5bc/builtin/update-ref.c:679:3: note: Shadowed variable 21b8a5bc/builtin/update-ref.c:595:35: note: Shadow argument Explanation: The 'Shadowed variable' at line 679:3 is the file-scope static `command[]` table, which is declared after `report_ok()` at line 595. At line 595 that global is not yet visible, so the parameter `command` cannot shadow it. The old warning was a false positive, and the PR correctly skips global variables declared after the shadowing line (#15114). ---- 20 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:133:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:133:27: note: Shadow argument Explanation: The parameter 'pretty' of make_arr1 is at line 133. The supposedly shadowed global 'pretty' is declared at line 437, after this function. A global declared later is not in scope at line 133, so the parameter does not shadow it. The old warning was a false positive, and the PR correctly skips global variables declared after the shadowing declaration. ---- 21 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:144:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:144:27: note: Shadow argument Explanation: The 'shadowed variable' at line 437 is declared after make_arr2 (line 144). In C a global variable declared later is not in scope at line 144, so the parameter 'pretty' cannot shadow it. The PR skips global variables declared after the shadowing line, which removes this false positive. ---- 22 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:166:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:166:27: note: Shadow argument Explanation: The 'shadowed' variable is a file-scope `static int pretty` declared at line 437, well after `make_arr4(int pretty)` at line 166. A global declared later is not visible at line 166, so the parameter does not shadow anything there. The PR now skips global variables declared after the shadowing line, which removes this false positive. ---- 23 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:217:30: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:217:30: note: Shadow argument Explanation: The argument 'pretty' at line 217 is said to shadow a global declared at line 437, which comes after this function. At line 217 that global is not yet declared, so it cannot be shadowed. The warning was a false positive. The PR now skips global variables declared after the shadowing argument, so removing this warning is correct. ---- 24 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:259:30: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:259:30: note: Shadow argument Explanation: The parameter 'pretty' of make_inline2 is on line 259. The global variable 'pretty' is declared later, on line 437. In C a declaration is only visible after its point of declaration, so at line 259 there is no outer 'pretty' to shadow. The old warning was a false positive. The PR now skips global variables declared after the shadowing argument, which correctly removes this warning. ---- 25 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:40:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:40:27: note: Shadow argument Explanation: The parameter 'pretty' of make_obj1 is on line 40. The global variable it supposedly shadows is declared later, at line 437. At line 40 that global is not yet visible, so nothing is shadowed and the warning was a false positive. The PR now skips global variables declared after the shadowing line, which removes this false warning. ---- 26 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:73:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:73:27: note: Shadow argument Explanation: The parameter 'pretty' of make_obj4 is on line 73. The 'shadowed' variable is a global declared later, on line 437. In C, a global declared after the function is not in scope inside that function, so nothing is shadowed. The old warning was a false positive. The PR now skips global variables declared after the shadowing declaration, which removes it correctly. ---- 27 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:84:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:84:27: note: Shadow argument Explanation: The parameter 'pretty' of make_obj5 is at line 84. The 'shadowed' variable is declared at line 437, after this function. In C, a global declared later is not visible at line 84, so nothing is shadowed and the warning was a false positive. The PR skips global variables declared after the shadowing line, which removes the warning correctly. ---- 28 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-json-writer.c:93:27: style: Argument 'pretty' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-json-writer.c:437:12: note: Shadowed variable 21b8a5bc/t/helper/test-json-writer.c:93:27: note: Shadow argument Explanation: In make_obj6 (line 93), the argument 'pretty' cannot shadow the global 'pretty' declared later at line 437. In C, a global declared after the function is not in scope at that point, so nothing is shadowed. The PR now skips global-scope variables declared after the shadowing line. Removing this warning removes a false positive. ---- 29 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/git/git_2.55.0+next.20260731.orig.tar.gz Result: main 21b8a5bc/t/helper/test-parse-options.c:261:30: style: Argument 'test_flags' shadows outer variable [shadowVariable] 21b8a5bc/t/helper/test-parse-options.c:281:29: note: Shadowed variable 21b8a5bc/t/helper/test-parse-options.c:261:30: note: Shadow argument Explanation: The parameter 'test_flags' at line 261 belongs to a function defined before the file-scope static 'test_flags' at line 281. In C, a global declared later in the file is not visible at that point, so nothing is shadowed. The warning was a false positive. The PR skips global variables declared after the shadowing line, which removes it correctly. ---- 30 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mpv/mpv_0.41.0.orig.tar.gz Result: main mpv-player-mpv-2c219aa/demux/demux_lavf.c:407:56: style: Argument 'prefixes' shadows outer variable [shadowVariable] mpv-player-mpv-2c219aa/demux/demux_lavf.c:417:26: note: Shadowed variable mpv-player-mpv-2c219aa/demux/demux_lavf.c:407:56: note: Shadow argument Explanation: The parameter 'prefixes' of remove_prefix (line 407) comes before the global array 'prefixes', which is declared later at line 417. At line 407 the global is not visible yet, so nothing is shadowed and the old warning was a false positive. The PR now skips global variables declared after the shadowing variable, which removes this false positive. ---- 31 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mpv/mpv_0.41.0.orig.tar.gz Result: main mpv-player-mpv-2c219aa/osdep/terminal-unix.c:207:45: style: Argument 'input_ctx' shadows outer variable [shadowVariable] mpv-player-mpv-2c219aa/osdep/terminal-unix.c:397:26: note: Shadowed variable mpv-player-mpv-2c219aa/osdep/terminal-unix.c:207:45: note: Shadow argument Explanation: The parameter 'input_ctx' of process_input() at line 207 is reported as shadowing a global 'input_ctx' declared at line 397. That global is declared after the function, so it is not in scope at line 207 and nothing is actually shadowed. This is the case the PR fixes (#15114): global variables declared after the shadowing line are now skipped. Removing this false positive is an improvement. ---- 32 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/n/net-acct/net-acct_0.71.orig.tar.gz Result: main net-acct-0.71-glibc2/src/config.c:21:34: style: Argument 'fname' shadows outer variable [shadowVariable] net-acct-0.71-glibc2/src/netacct.h:220:14: note: Shadowed variable net-acct-0.71-glibc2/src/config.c:21:34: note: Shadow argument Explanation: config.c includes netacct.h at line 11, and the header declares a global `fname` at line 220. The parameter `fname` of `read_config` at config.c:21 really does shadow that global, so main's warning was a true positive. The PR now skips global variables whose line number is greater than the use's line number. It compares line 220 in netacct.h with line 21 in config.c without checking that they are different files, so the header declaration is wrongly treated as coming later. The true positive is lost because of this cross-file line comparison bug. ---- 33 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/n/net-acct/net-acct_0.71.orig.tar.gz Result: main net-acct-0.71-glibc2/src/config.c:26:20: style: Local variable 'cfg' shadows outer variable [shadowVariable] net-acct-0.71-glibc2/src/netacct.h:210:23: note: Shadowed variable net-acct-0.71-glibc2/src/config.c:26:20: note: Shadow local variable Explanation: `netacct.h` is included at the top of `config.c` and declares a global `cfg` at line 210. The local `cfg` in `read_config` (`config.c` line 26) does shadow it, so the removed warning was a true positive. The PR now skips global-scope variables whose declaration line number is greater than the current line, but it compares line numbers across different files. Because 210 > 26, the earlier header declaration is wrongly treated as declared later and ignored. The same flaw also removes the `fname` warning in `config.c`. ---- 34 / 50 ---- Verdict: NEUTRAL (medium confidence) Package: https://ftp.debian.org/debian/pool/main/n/net-acct/net-acct_0.71.orig.tar.gz Result: main net-acct-0.71-glibc2/src/main.c:158:26: style: Argument 'fname' shadows outer variable [shadowVariable] net-acct-0.71-glibc2/src/netacct.h:220:14: note: Shadowed variable net-acct-0.71-glibc2/src/main.c:158:26: note: Shadow argument Explanation: The `fname` argument of `save_dumpfile` really does shadow a global `fname`. That global is declared in netacct.h:220 (likely `extern`) and, it appears, defined at main.c:23. The PR does not drop this warning. It re-reports it with the shadowed note pointing at main.c:23 instead of netacct.h:220. The new location appears only because the PR now compares line numbers across files: header line 220 > 158 gets skipped. That cross-file comparison is a flaw, and it is what drops the config.c warnings. For this line, though, both locations name the same variable and the warning stays correct, so users lose nothing here. ---- 35 / 50 ---- Verdict: NEUTRAL (medium confidence) Package: https://ftp.debian.org/debian/pool/main/n/net-acct/net-acct_0.71.orig.tar.gz Result: your net-acct-0.71-glibc2/src/main.c:158:26: style: Argument 'fname' shadows outer variable [shadowVariable] net-acct-0.71-glibc2/src/main.c:23:7: note: Shadowed variable net-acct-0.71-glibc2/src/main.c:158:26: note: Shadow argument Explanation: The warning is still reported for the parameter `fname` of `save_dumpfile()`. Only the 'Shadowed variable' location changed. Main pointed at netacct.h:220, likely the header's `extern char *fname;`. The PR points at main.c:23:7, which fits a global definition `char *fname;` in main.c. Both are declarations of the same global, and it is declared before line 158, so the shadowing is real. The warning remains a true positive, and moving the note from the extern declaration to the definition in the same file does not matter to users. The underlying cause is a questionable comparison of line numbers across files: 220 > 158 skips the header declaration. That causes the separate config.c removals, but this particular result is not worse. ---- 36 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmldraw.c:944:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmldraw.c:2684:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmldraw.c:944:15: note: Shadow argument Explanation: The parameter 'pNode' of HtmlDrawOverflow at line 944 is said to shadow a variable at line 2684, which is far later in the file. The column (15) matches a K&R-style parameter declaration like ' HtmlNode *pNode;', so it is most likely another function's parameter that Cppcheck misread as a global. Even if it were a real global, a declaration after the function cannot be shadowed by it. The PR skips global-scope variables declared after the shadowing line, so this false positive is correctly removed. ---- 37 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltable.c:468:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltable.c:1267:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltable.c:468:15: note: Shadow argument Explanation: The 'shadowed variable' is at line 1267, which comes after the K&R-style parameter 'pNode' at line 468. It is most likely another function's parameter that Cppcheck mis-scopes as global. Even if it really were a global, a variable declared later in the file cannot be shadowed by an earlier function's argument. The PR now skips global variables declared after the line being checked, so this false positive is correctly removed. ---- 38 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltable.c:695:11: style: Argument 'pContext' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltable.c:1270:11: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltable.c:695:11: note: Shadow argument Explanation: The argument 'pContext' of the K&R-style function tableCountCells is declared at line 695. The 'shadowed' variable is at line 1270, much later in the file. In C, a file-scope declaration is not visible before the point where it is declared, so nothing at line 695 can shadow it; whatever sits at 1270 (most likely the K&R parameter list of a later function, seen at file scope), this is a false positive. The PR now skips global-scope variables declared after the shadowing line, which removes this wrong warning. ---- 39 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltable.c:712:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltable.c:1267:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltable.c:712:15: note: Shadow argument Explanation: Line 712 is the K&R-style parameter `pNode` of `tableCountRows`. The 'shadowed variable' is reported at line 1267, which is later in the file. It is most likely another K&R function's parameter that Cppcheck sees as a global. Either way, a declaration that comes after line 712 cannot be shadowed by a parameter at line 712. The PR now skips later global-scope declarations, so this false positive is correctly removed. ---- 40 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltable.c:897:11: style: Argument 'pContext' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltable.c:1270:11: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltable.c:897:11: note: Shadow argument Explanation: The argument 'pContext' of the K&R-style function tableDrawCells at line 897 is reported as shadowing a variable at line 1270. The PR only changes global scope, so that 'variable' is a global-scope entity declared about 370 lines later. It is not visible at line 897, so nothing can be shadowed there. The pattern of many arguments 'shadowing' the same lines 1267/1270 also points to Cppcheck misreading K&R parameter declarations as globals. Removing this false positive is correct and matches the PR's intent (#15114). ---- 41 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:159:16: style: Argument 'clientData' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1511:16: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:159:16: note: Shadow argument Explanation: The argument 'clientData' at line 159 belongs to a K&R-style function. The 'shadowed' variable is at line 1511, much later in the file. Since the PR only changed handling of later-declared global-scope variables, cppcheck treated that line-1511 declaration as global; it is most likely a later function's K&R parameter. Either way, nothing declared at line 1511 can be shadowed by code at line 159. The removed warning was a false positive, and the PR correctly skips global variables declared after the shadowing variable. ---- 42 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:161:15: style: Local variable 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1510:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:161:15: note: Shadow local variable Explanation: The local 'pNode' at line 161 is declared inside geomRequestProcCb. The supposedly shadowed 'pNode' is at line 1510, more than 1300 lines later. That is most likely a K&R-style parameter declaration that Cppcheck treated as a global. Even if it were a real global, it is not visible at line 161, so nothing is shadowed. The PR now skips global-scope variables declared after the shadowing variable, which removes this false positive. ---- 43 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:168:16: style: Argument 'clientData' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1511:16: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:168:16: note: Shadow argument Explanation: The argument 'clientData' at line 168 belongs to the K&R-style function geomRequestProc. The supposedly shadowed 'clientData' is declared at line 1511, after this function. It is most likely a K&R parameter of another function that Cppcheck took for a global. Even if it were a real global, it is not in scope at line 168, so nothing is shadowed. The PR skips global variables declared after the shadowing line, which removes this false positive. ---- 44 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:281:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1510:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:281:15: note: Shadow argument Explanation: Argument 'pNode' of freeNode at line 281 is reported as shadowing a variable declared at line 1510. That declaration comes later in the file, so it cannot be in scope at line 281. It is most likely a K&R-style parameter declaration that Cppcheck treats as a global variable. The PR makes the shadow check skip global variables declared after the shadowing line, so this false positive is removed. ---- 45 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:767:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1510:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:767:15: note: Shadow argument Explanation: The K&R-style parameter 'pNode' of HtmlNodeAddTextChild is declared at line 767. The supposedly shadowed variable is declared at line 1510, later in the file. In C, an outer variable declared after the function is not in scope there, so nothing is shadowed. The old warning was a false positive. The PR now skips global-scope variables declared after the shadowing line, which removes it correctly. ---- 46 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:867:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1510:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:867:15: note: Shadow argument Explanation: The argument 'pNode' of the K&R-style function mergeAttributes is declared at line 867. The supposedly shadowed variable is at line 1510, much later in the file. In C, a global declared later is not visible at line 867, so nothing is shadowed. Most likely line 1510 is another K&R parameter declaration that Cppcheck took for a global. The PR skips global-scope variables declared after the shadowing line, which removes this false positive. ---- 47 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/src/htmltree.c:909:15: style: Argument 'pNode' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/src/htmltree.c:1510:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/src/htmltree.c:909:15: note: Shadow argument Explanation: The argument 'pNode' at line 909 belongs to a K&R-style function. The supposedly shadowed 'pNode' is at line 1510, far below it. It is most likely another K&R parameter declaration that Cppcheck treats as a global variable. Either way, a variable declared after the function cannot be shadowed by that function's argument. The PR now skips global-scope variables declared after the shadowing line, so this false positive is correctly removed. ---- 48 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/tools/lemon.c:1392:8: style: Argument 'argv' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/tools/lemon.c:1646:15: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/tools/lemon.c:1392:8: note: Shadow argument Explanation: The K&R parameter 'argv' of main at line 1392 was reported as shadowing a global variable declared later, at line 1646. In C, a global declared after the function is not in scope inside that function, so nothing is shadowed. The PR skips global variables declared after the reported line, which removes this false positive. ---- 49 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/tk-html3/tk-html3_3.0~fossil20110109.orig.tar.gz Result: main tkHTML-4ee7aaa953d6cb59/tools/lemon.c:785:16: style: Argument 'b' shadows outer variable [shadowVariable] tkHTML-4ee7aaa953d6cb59/tools/lemon.c:1570:7: note: Shadowed variable tkHTML-4ee7aaa953d6cb59/tools/lemon.c:785:16: note: Shadow argument Explanation: The argument 'b' of same_symbol() is at line 785, and the global 'b' it was said to shadow is declared later, at line 1570. A global declared after a function is not visible inside that function, so no shadowing happens. This was a false positive. The PR now skips global variables declared after the shadowing line, which removes it correctly. ---- 50 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/w/wpa/wpa_2.11.orig.tar.xz Result: main wpa-2.11/src/crypto/crypto_module_tests.c:902:4: style: Local variable 'tests' shadows outer variable [shadowVariable] wpa-2.11/src/crypto/crypto_module_tests.c:1426:3: note: Shadowed variable wpa-2.11/src/crypto/crypto_module_tests.c:902:4: note: Shadow local variable Explanation: The local 'tests' array at line 902 in test_md5() is declared before the global variable 'tests' at line 1426. In C, a global declared later in the file is not visible at line 902, so nothing is shadowed and the old warning was a false positive. The PR now skips global-scope variables declared after the local, which matches the #15114 case, so removing this warning is correct.