{ "tokens": { "input": 98201, "cache_read": 90192, "cache_write": 3758, "output": 28237 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/b/blop/blop_0.2.8.orig.tar.gz", "main blop-0.2.8/src/quantiser.so.c:143:30: style: Parameter 'v' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`fuzzy_bsearch` only reads `v` (`v[m] < sought`, `FABSF(v[m] - sought)`, etc.) and never writes through it, so declaring `v` as pointer to const is valid and the warning was a true positive. The PR now skips over a `+`/`-` parent that has no valueType (here `LADSPA_Data` is likely unknown), so `v[m] - sought` passed to `FABSF` looks like the pointer being passed to a function. That suppresses the warning: a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/dbus-test-runner/dbus-test-runner_19.04.0.orig.tar.gz", "main dbus-test-runner-19.04.0/libdbustest/process.c:392:26: style: Variable 'priv' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`priv` is only read in this function (`return priv->pid;`), so it could be `const DbusTestProcessPrivate *` and the warning was a true positive. The return type `GPid` is a glib typedef that Cppcheck cannot resolve. With the PR, `returnsReference(function, /*unknown*/ true)` now assumes such a function might return a reference, so the warning is suppressed. This is C code, where references do not exist, so a correct warning was lost. That is a new false negative caused by the more conservative handling." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/dbus-test-runner/dbus-test-runner_19.04.0.orig.tar.gz", "main dbus-test-runner-19.04.0/libdbustest/task.c:283:23: style: Variable 'priv' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In `dbus_test_task_get_return`, `priv` is only read: `return priv->return_type;`. It could be declared as pointer to const, so the removed warning was a true positive. The PR now treats an unknown return type as a possible reference (`returnsReference(function, true)`). The return type here is the typedef `DbusTestTaskReturn`, which Cppcheck likely cannot resolve, so the check now skips this return. This is C code, where reference returns cannot exist, so the lost warning is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/dbus-test-runner/dbus-test-runner_19.04.0.orig.tar.gz", "main dbus-test-runner-19.04.0/libdbustest/task.c:455:23: style: Variable 'priv' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`priv` is only read in `return priv->preferred_bus;`, so it could be declared as pointer to const. The original warning was a true positive. This is a C file, so the return type `DbusTestServiceBus` (an enum typedef) can never be a reference. The PR now passes `unknown=true` to `returnsReference`, so an unresolved return type is treated as a possible reference and the check is skipped. That turns a correct warning into a false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/ddnet/ddnet_20.2.1+ds.orig.tar.xz", "main DDNet-20.2.1/src/game/client/prediction/entities/plasma.cpp:26:14: style: Variable 'pTarget' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`pTarget` is only read: it is null-checked, then `pTarget->m_Pos` is used in `pTarget->m_Pos - m_Pos`. That expression yields a temporary vec2 passed to `normalize`. So `pTarget` could be `const CCharacter *`, and the removed warning was a true positive. The PR now walks past `+`/`-` operators that have no valueType, as if they were pointer arithmetic. The vec2 subtraction's type is evidently not known, so the check now treats `pTarget->m_Pos` as a direct argument to `normalize` and gives up. The result is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/ddnet/ddnet_20.2.1+ds.orig.tar.xz", "main DDNet-20.2.1/src/game/editor/editor.cpp:1013:67: style: Parameter 'Point' can be declared as reference to const [constParameterReference]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In DrawAxis, 'Point' is only read (Point.x, Point.y in arithmetic passed to fx2f), so it could be declared const CPoint&. The warning was a true positive. The PR now treats a '+'/'-' with an unknown valueType as pointer arithmetic and skips past it. Here 'Point.x - OriginalPoint.x' likely has an unknown type because vector2_base is a template. So 'Point' now looks like it is passed straight to fx2f and may be modified, and the valid warning is lost. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/g/geki3/geki3_1.0.3.orig.tar.gz", "main geki3-KXL-1.0.3/src/misc.c:117:10: style: Variable 'y' can be declared as const array [constVariable]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "The local array 'y' is never written. It is only read as 'y[Root->Cnt % 18]' inside an arithmetic expression passed by value to KXL_PutText, so it could be declared const and the warning was a true positive. The PR now walks past '+' nodes that have no valueType in getTokenArgumentFunctionImpl. Here the sum likely has no valueType because the macros or types are unknown, so Cppcheck treats 'y' as a function argument and drops the warning. This is a new false negative, a side effect of fixing the pointer-arithmetic false positive the PR targets." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/g/gnome-console/gnome-console_51.0.orig.tar.xz", "main gnome-console-51.0/src/kgx-process.c:112:34: style: Parameter 'self' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`kgx_process_get_pid` only reads `self` (a NULL check and `return self->pid`), so `self` could be `const KgxProcess *`. The old warning was a true positive. The file is C, where references don't exist. Because `GPid` is unknown without the glib headers, the new `returnsReference(function, unknown=true)` call assumes the function might return a reference and drops the warning. The result is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/g/gnome-console/gnome-console_51.0.orig.tar.xz", "main gnome-console-51.0/src/kgx-process.c:150:37: style: Parameter 'self' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`kgx_process_get_parent` only reads `self->parent` and returns it by value, so `self` could be `const KgxProcess *`. The old warning was a true positive. `GPid` is a typedef from glib headers Cppcheck does not see, so the return type is unknown. With the PR, `returnsReference(function, /*unknown*/ true)` treats that unknown return type as a possible reference, and the check no longer skips the `return self->parent` case. The warning is therefore lost: a new false negative caused by the more conservative handling." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/g/gnome-console/gnome-console_51.0.orig.tar.xz", "main gnome-console-51.0/src/kgx-train.c:333:20: style: Variable 'priv' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`priv` is only read (`return priv->pid;`), so declaring it as pointer to const is valid, and the main warning was a true positive. The function's return type `GPid` comes from an unseen glib header, so Cppcheck cannot resolve it. The PR now calls `returnsReference(function, unknown=true)`, which treats an unknown return type as a possible reference and skips the check. The file is C, where references don't exist, so this is a new false negative. It is a side effect of the PR's more conservative handling." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/h/hamlib/hamlib_4.7.2.orig.tar.gz", "main hamlib-4.7.2/rigs/icom/icom.c:994:23: style: Variable 'rs' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In icom_current_vfo, `rs` is only read in the visible code: `rs->priv`, `rs->current_vfo` in a return, and a use inside `#if 0`. Main found no write to `rs` anywhere in the function, so the warning was most likely a true positive. The function returns `vfo_t`, a plain integer typedef in hamlib. Cppcheck probably cannot resolve that typedef here, likely because the hamlib headers were not included. The PR now calls `returnsReference(..., unknown=true)`, so an unresolved return type is treated as a possible reference. As a result, `return rs->current_vfo;` now counts as a non-const use and the warning disappears. That conservative change creates a false negative here, not the removal of a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/h/haskell-primitive/haskell-primitive_0.9.1.0.orig.tar.gz", "your primitive-0.9.1.0/cbits/primitive-memops.c:43:41: style: Parameter 's1' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`hsprimitive_memcmp_offset` only passes `s1 + off1` to `memcmp`, which takes `const void*`. `s1` is never written through, so it can be declared `const HsWord8 *`, and the warning is a true positive. Main missed it because `HsWord8` is an unknown type, so the `+` expression had no valueType. The PR now skips through such an arithmetic parent to find the function argument. This matches the existing behavior for the sibling `hsprimitive_memcmp`, which passes `s1` directly." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/h/haskell-primitive/haskell-primitive_0.9.1.0.orig.tar.gz", "your primitive-0.9.1.0/cbits/primitive-memops.c:43:66: style: Parameter 's2' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`s2` is only used in `memcmp(s1 + off1, s2 + off2, n)`, and `memcmp` takes `const void*`, so `s2` can be declared `const HsWord8 *`. Before the PR, Cppcheck did not follow the pointer through `s2 + off2` because `HsWord8`/`HsInt` come from an unavailable header, so the `+` expression had no value type. The PR now accepts an unknown value type, so it reaches `memcmp` and reports the parameter. This is a correct new warning, consistent with how `s1` and `s2` in `hsprimitive_memcmp` on line 38 would be treated." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/k/kf6-kwindowsystem/kf6-kwindowsystem_6.32.0.orig.tar.xz", "main kwindowsystem-6.32.0/src/platforms/xcb/kwindowshadow.cpp:86:16: style: Variable 'd' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`d` is a pointer that is only used to read `d->pixmap`, and the function returns `xcb_pixmap_t` by value. Declaring it as `const auto* d`/`const KWindowShadowTilePrivateX11* const d` is valid, so the warning was a true positive. The PR now calls `returnsReference(function, /*unknown*/ true)`. Because `xcb_pixmap_t` is a typedef from an external header that Cppcheck likely cannot resolve, the return type is treated as possibly a reference and the warning is suppressed. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/k/kraptor/kraptor_0.0.20040403+ds.orig.tar.xz", "main kraptor_final_apr_03_2004/src/guiprocs.c:448:32: style: Parameter 'd' can be declared as pointer to const. However it seems that 'xbox_proc' is a callback function, if 'd' is declared with const you might also need to cast function pointer(s). [constParameterCallback]\n kraptor_final_apr_03_2004/src/guiprocs.c:58:31: note: You might need to cast the function pointer here\n kraptor_final_apr_03_2004/src/guiprocs.c:448:32: note: Parameter 'd' can be declared as pointer to const" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`xbox_proc` only reads `d->x`, `d->y`, `d->w`, `d->h` and `d->d1`, and passes them by value to `gui_rect`/`rectfill`. So `d` could be pointer to const, and the old warning was a true positive. Its callback wording makes it low-value but not wrong. The PR now treats a `+`/`-` with no known valueType as possible pointer arithmetic. The DIALOG type is likely unknown here, so `d->x+1` has no valueType. Cppcheck then probably follows `d->x+1` up into the `rectfill(...)` call and treats it as an argument to an unknown function, so it bails out. This loses a true positive, giving a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/l/lxpanel/lxpanel_0.11.1.orig.tar.gz", "main lxpanel-0.11.1/src/systray/eggtraymanager.c:901:49: style: Parameter 'manager' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "na_tray_manager_get_orientation() only reads the pointer: it checks the type of 'manager' and returns manager->orientation. 'manager' could be declared as pointer to const, so the old warning was a true positive. The PR now passes unknown=true to returnsReference(). Cppcheck does not know the return type GtkOrientation (an unresolved GTK typedef), so it assumes the function might return a reference and skips the warning. This is C code, which has no references, so a valid warning was lost. That is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/menu-cache/menu-cache_1.1.1.orig.tar.gz", "main menu-cache-1.1.1/libmenu-cache/menu-cache.c:321:15: style: Variable 'sp' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`sp` holds the result of `strchr` and is only compared (`== NULL`, `< bn`) and subtracted (`sp - app->exec`, `sp - &bn[1]`). It is never written through, so `const char *sp` would be valid and the removed warning was a true positive. The PR now walks up past `+`/`-` nodes that have no valueType, probably because the type of `app->exec` is not fully known here. That makes `sp` look like an argument passed to `g_string_append_len`, and the warning is suppressed. The result is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/menu-cache/menu-cache_1.1.1.orig.tar.gz", "main menu-cache-1.1.1/libmenu-cache/menu-cache.c:953:56: style: Parameter 'item' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`menu_cache_item_get_type` only reads `item->type` and returns it by value; this is C code, so it cannot return a reference. The `constParameterPointer` warning was a true positive. The PR now passes `unknown=true` to `returnsReference`. Because the return type `MenuCacheType` is probably an unresolved typedef, Cppcheck now assumes it might be a reference and suppresses the warning. That loses a correct style warning: a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mmh/mmh_0.4.orig.tar.gz", "main mmh-0.4/uip/flist.c:679:15: style: Variable 'np' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`np` is only used to read: `np->n_next`, `np->n_name`, and `np->n_name + atrlen`, which is passed to `BuildFolderList`. Making it `const struct node *np` would make `n_name` a `char * const`. That still converts to `char *`, so the code would compile and the original warning was a true positive. The PR now treats the `+` expression as passing the pointer into the function call, which hides this. A valid suggestion is lost, a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mmh/mmh_0.4.orig.tar.gz", "main mmh-0.4/uip/folder.c:636:15: style: Variable 'np' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`np` only walks the `m_defs` list and reads `np->n_name`. In mmh, `n_name` is a `char *` member, so making `np` a `const struct node *` keeps `np->n_name + atrlen` a `char *`, which can still be passed to `get_folder_info`. The original warning was therefore a true positive. The PR now also steps over `+` when its value type is unknown (here `struct node` likely comes from a header Cppcheck cannot see). As a result it treats `np` as passed to an unknown function and suppresses the warning. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/intl/icu/source/i18n/ulocdata.cpp:98:39: style: Parameter 'uld' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`ulocdata_getNoSubstitute` only reads `uld->noSubstitute` and returns a `UBool` by value, so `uld` could be `const ULocaleData*`. The warning was a true positive. The PR now passes `unknown=true` to `returnsReference()`. The unresolved `U_CAPI`/`U_EXPORT2` macros likely leave the return type unclear, so Cppcheck now assumes the function might return a reference and skips the warning. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/js/src/debugger/Script.cpp:1371:22: style: Variable 'pc' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`pc` is only read in `pc - script->code()`. The difference is a ptrdiff_t that is passed to NumberValue. `const jsbytecode* pc` would compile fine from a vector of `jsbytecode*`, so the warning was a true positive. The PR now walks past a '-' whose valueType is unknown. Cppcheck then treats `pc` as a direct argument of NumberValue and assumes it may be modified, so this valid warning is lost (a new false negative)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/js/src/debugger/Script.cpp:1372:78: style: Consider using std::any_of algorithm instead of a raw loop. [useStlAlgorithm]" ], "verdict": { "verdict": "acceptable regression", "confidence": "low", "explanation": "The loop `for (jsbytecode* pc : adjacent) { if (!NewbornArrayPush(...NumberValue(pc - script->code()))) return false; }` has the early-return shape Cppcheck reports as useStlAlgorithm. The PR now treats `+`/`-` with an unknown valueType as pointer arithmetic. Here `script->code()` probably has an unknown type, so `pc - script->code()` is taken to mean `pc` is passed as a pointer into `NumberValue`. `pc` may then be considered possibly modified, which suppresses both the constVariablePointer warning for `pc` and this useStlAlgorithm suggestion. Pointer minus pointer actually yields an integer and does not modify `pc`, so the removal comes from a less precise analysis, not a real fix. The suggestion itself is weak style advice, since the loop body has side effects, so losing it costs little: a true-ish positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/misc/prerror.c:13:15: style: Variable 'thread' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`thread` is only read (`return thread->errorCode;`), and the function returns `PRErrorCode`, an integer typedef, by value. So `PRThread *thread` could indeed be `const PRThread *`, and the removed warning was a true positive. The PR now passes `unknown=true` to `returnsReference`. Cppcheck cannot resolve the return type here, which is hidden behind the `PR_IMPLEMENT(...)` macro, so it now treats the function as possibly returning a reference and suppresses the warning. That is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/misc/prerror.c:19:15: style: Variable 'thread' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`PR_GetOSError` only reads `thread->osErrorCode` and returns it by value as `PRInt32`. This is C code, so it cannot return a reference, and `thread` really could be `const PRThread *`. The warning was a true positive. The return type is hidden behind the `PR_IMPLEMENT` macro, so Cppcheck likely cannot resolve it. With the PR, `returnsReference(function, /*unknown*/ true)` treats that unknown return type as a possible reference, so the warning is dropped. This is a new false negative caused by the more conservative handling." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/misc/prerror.c:65:15: style: Variable 'thread' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In PR_GetErrorTextLength, 'thread' is only read: `return thread->errorStringLength;`. The function returns PRInt32 by value, so 'thread' could be declared as `const PRThread*`, and the old warning was a true positive. The return type is hidden behind the PR_IMPLEMENT macro, which Cppcheck likely cannot resolve. With the PR, returnsReference(function, unknown=true) treats that unknown return type as possibly a reference, so the check now skips the variable. This loses a correct warning, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/misc/prerror.c:71:15: style: Variable 'thread' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In PR_GetErrorText, 'thread' is only read: it reads errorStringLength and errorString, passes errorString as memcpy's source, and returns errorStringLength by value as PRInt32. Declaring it 'const PRThread *' is valid, so the removed warning was a true positive. The PR now treats unknown return-by-reference as true; PR_IMPLEMENT(PRInt32) is a macro, so the return type is probably not resolved. It also handles '+' with an unknown valueType more conservatively, likely affecting 'thread->errorStringLength+1' in the memcpy call. Either change can suppress the warning. The result is a new false negative, not a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/threads/prcthr.c:136:49: style: Parameter 'thread' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "PR_GetThreadID only reads `thread->id` and returns it by value as PRUint32, so `thread` could be `const PRThread *`; the sibling PR_GetThreadPriority already takes `const PRThread *`. The warning was a true positive. The return type is hidden behind the PR_IMPLEMENT macro, so Cppcheck probably cannot tell whether the function returns a reference. With the PR's `unknown=true` in returnsReference, that uncertainty now suppresses the warning. This is a new false negative, accepted as a trade-off to avoid false positives." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/src/threads/prcthr.c:288:55: style: Parameter 'thread' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "GetExecutionEnvironment only reads `thread->environment` and returns that void* by value. `thread` is never modified, so declaring it `const PRThread *` would compile, and the removed warning was a true positive. The function signature is wrapped in the PR_IMPLEMENT macro, which Cppcheck probably cannot resolve. That leaves the return type unknown, and the PR now treats an unknown return type as possibly returning a reference. That suppresses the warning: a lost true positive, not a false positive fixed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/tests/sel_spd.c:56:38: style: Parameter 'start' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`_delta` only reads through `start` (`*stop - *start`) and passes the resulting value by value to `PR_IntervalToMicroseconds`. `start` can be `const PRIntervalTime*`, so the removed warning was a true positive. The PR now treats a `+`/`-` with an unknown valueType (PRIntervalTime comes from unresolved headers) as pointer arithmetic. It therefore thinks the pointer itself is passed to the function and suppresses the warning. This is a new false negative, traded for fixing the false positives in #15226." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mozjs78/mozjs78_78.15.0.orig.tar.xz", "main firefox-78.15.0/nsprpub/pr/tests/sel_spd.c:56:61: style: Parameter 'stop' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In `_delta`, `stop` is only dereferenced and read in `*stop - *start`. The result is passed by value to `PR_IntervalToMicroseconds`, so `stop` could be `const PRIntervalTime *`, and the old warning was a true positive. `PRIntervalTime` is probably an unknown typedef here, so the `-` node has no valueType. The PR now treats a `+`/`-` with unknown type like pointer arithmetic and skips past it. The dereferenced value then looks like an argument passed to a function, which suppresses the warning. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/muse/muse_4.3.0.orig.tar.gz", "main muse-sequencer-muse-8d1030d/src/muse/components/unusedwavefiles.cpp:114:9: performance: Range variable 'file' should be declared as const reference. [iterateByValue]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "Inside the Qt foreach loop, `file` is only read: it is concatenated with `+` and passed to `QFile::rename` and the `QFileInfo` constructor. Declaring it as `const QString&` would be valid, so the iterateByValue warning was a true positive (although QString's implicit sharing makes the copy cheap). The PR now skips `+` operators whose valueType is unknown, which is the case for QString concatenation here. As a result, `file` is treated as being passed directly to a function that might modify it, and the warning is lost. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/openmsx/openmsx_21.0+dfsg.orig.tar.xz", "main openMSX-openMSX-9095d0f/src/3rdparty/imgui/imgui.cc:16545:32: style: Variable 'monitor' can be declared as reference to const [constVariableReference]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In the range-for loop, `monitor` is only read: `monitor.WorkPos` and `monitor.WorkPos + monitor.WorkSize` are passed to `ImRect::Add`. So `const ImGuiPlatformMonitor&` would work, and the warning was a true positive. The PR now walks past a `+`/`-` parent that has no known valueType (here probably the `ImVec2 operator+` expression) and treats the operand as a direct function argument. The variable then counts as possibly modified through the call, so the warning is lost. This is a new false negative in exchange for fixing the false positive in #15226." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/optee-os/optee-os_4.10.0.orig.tar.gz", "main optee_os-4.10.0/core/drivers/crypto/stm32/stm32_cryp.c:343:49: style: Parameter 'ctx' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`cryp_end` only reads `ctx->base` (a `vaddr_t` integer in OP-TEE) and passes `ctx->base + _CRYP_CR` by value to `io_clrbits32`. `ctx` is never written through, so it could be declared pointer to const and the old warning was a true positive. The PR now treats a `+`/`-` with an unknown valueType as pointer arithmetic. Here the type is unknown, likely because headers are missing, so the expression is seen as passing `ctx` to a function that might modify it, and the warning is suppressed. This is a new false negative accepted to fix #15226." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/optee-os/optee-os_4.10.0.orig.tar.gz", "main optee_os-4.10.0/core/drivers/firewall/stm32_serc.c:199:30: style: Variable 'pdata' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`pdata` is only read, in `io_setbits32(pdata->base + _SERC_ENABLE, ...)`. `base` is a `vaddr_t` (an integer), so the call writes to hardware through the address value and never modifies `*pdata`. `pdata` could be declared `const struct stm32_serc_platdata *`, so the warning was a true positive. The PR now treats `+`/`-` with an unknown value type as possible pointer arithmetic. As a result it treats `pdata` as passed to the function and drops the warning: a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/optee-os/optee-os_4.10.0.orig.tar.gz", "main optee_os-4.10.0/core/drivers/i2c/atmel_i2c.c:95:52: style: Parameter 'i2c' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "atmel_i2c_send_start only reads i2c->base, which is a vaddr_t integer, and passes the sum to io_write32 by value. The struct is never modified, so 'i2c' really can be pointer to const and the removed warning was a true positive. The PR now treats a '+' whose valueType is unknown as pointer arithmetic. The call io_write32(i2c->base + TWIHS_CR, ...) is therefore seen as passing the variable to an unknown function, which suppresses the warning. The result is a new false negative, which is the expected trade-off of this PR." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/oss4/oss4_4.2-build2020.orig.tar.bz2", "main oss-v4.2-build2020-src-gpl/kernel/drv/oss_envy24ht/oss_envy24ht.c:1674:19: style: Variable 'portc' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In envy24ht_prepare_for_input, 'portc' is only read: 'portc->base + 0x00' etc. is passed by value to the OUTL/OUTW macros. Nothing is written through 'portc', so 'envy24ht_portc *portc' could be declared pointer to const, and the old warning was a true positive. The PR now walks past a '+'/'-' parent even when its valueType is unknown, which is likely the case here because 'portc->base' has an unresolved type. The expression is then treated as an argument to an unknown function, so the warning is suppressed. This is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/oss4/oss4_4.2-build2020.orig.tar.bz2", "main oss-v4.2-build2020-src-gpl/kernel/drv/oss_fmedia/oss_fmedia.c:349:16: style: Variable 'dmapout' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`dmapout` is only read through. The code reads `dmapout->nfrags`, `dmapout->fragment_size` and `dmapout->dmabuf_phys`. `dmabuf_phys` is a physical-address integer, and the sum is passed by value to OUTL. Nothing is written through the pointer, so `dmap_t *dmapout` could be `const dmap_t *`, and the original warning was a true positive. The PR now walks past a `+` whose value type is unknown (here, probably because the types come from unresolved headers). That makes the expression look like the pointer is passed to the unknown function/macro OUTL, which suppresses the warning. The result is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/oss4/oss4_4.2-build2020.orig.tar.bz2", "main oss-v4.2-build2020-src-gpl/lib/libsalsa/pcm.c:1183:28: style: Parameter 'pcm' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`snd_pcm_state()` only reads `pcm->state` and returns it by value as `snd_pcm_state_t`, an enum typedef from the ALSA headers. This is C code, so no reference is involved, and `pcm` really could be pointer to const. The warning was a true positive. The PR now passes unknown=true to `returnsReference`. When Cppcheck cannot resolve the `snd_pcm_state_t` return type, it now treats the function as possibly returning a reference and drops the warning. The result is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/q/qatzip/qatzip_2.0.0.orig.tar.xz", "main qatzip-2.0.0/src/qatzip_stream.c:366:20: style: Variable 'stream_buf' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In copyStreamInput, `stream_buf` is only read: `buf_len` is read, and `stream_buf->in_buf + strm->pending_in` is passed as the QZ_MEMCPY destination. That write goes into the buffer `in_buf` points to, not into the QzStreamBuf_T object, so `const QzStreamBuf_T *stream_buf` would compile and the warning was a true positive. The PR now walks through a `+` whose type is unknown up to the enclosing call, and treats the pointer as possibly modified by the call. That suppresses a correct warning, so it is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/remmina/remmina_1.4.44+dfsg.orig.tar.xz", "main Remmina-v1.4.44-03bb026b5fa1646115d1775367ccbfa27ae598cf/plugins/rdp/rdp_plugin.c:124:47: style: Parameter 'context' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "The function only reads `context->abortEvent` and returns it by value. HANDLE is a pointer typedef in WinPR, and this is a C file, so it cannot be a reference. `context` could therefore be `const rdpContext*`, which makes the removed warning a true positive. The PR now treats an unknown return type (HANDLE, whose header was not included) as possibly a reference and suppresses the warning. That is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rna-star/rna-star_2.7.11b+dfsg.orig.tar.xz", "main STAR-2.7.11b/source/SoloFeature_quantTranscript.cpp:43:11: style: Variable 'trDistCount' can be declared as reference to const [constVariableReference]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In the code shown, `trDistCount` is only read: `.size()`, `operator[]` reads, and `begin()+...` iterators passed to `std::accumulate`, which does not modify its range. So the constVariableReference warning looks like a true positive. The PR now walks past a `+` node with unknown valueType (here `trDistCount.begin()+max(...)`). The iterator is then treated as an argument passed to `std::accumulate`, which suppresses the warning. Later code (after line 83) is not shown, so a write there cannot be fully ruled out. Most likely this is a lost true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/siril/siril_1.4.5+ds.orig.tar.bz2", "main siril-1.4.5/src/algos/background_extraction.c:1416:57: style: Parameter 'sample' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`background_sample_get_position` only reads `sample->position` and returns `point` by value. This is C code, so it cannot return a reference, and `sample` really could be `const background_sample *`. The removed warning was a true positive. The PR now calls `returnsReference(..., unknown=true)`, so when the type `point` cannot be resolved, Cppcheck conservatively assumes a reference return and skips the warning. That is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/siril/siril_1.4.5+ds.orig.tar.bz2", "main siril-1.4.5/src/io/aavso_extended.c:188:26: style: Parameter 'plot' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The snippet stops at line 228 and never shows how `plot` is used in `export_AAVSO`, so it cannot be confirmed that `plot` is only read. The PR now treats `+`/`-` expressions with an unknown valueType as pointer arithmetic, and assumes an unknown return is a reference. Both changes are more conservative and would suppress the warning when `plot` appears in such an expression passed to a function or returned. If `plot` is only read, this removed a true positive (acceptable regression). If the function has to keep this signature, e.g. because it is used as an export callback, the warning was a false positive and its removal is an improvement. The shown code does not let us tell which." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/siril/siril_1.4.5+ds.orig.tar.bz2", "main siril-1.4.5/src/io/siril_catalogues.c:1552:53: style: Parameter 'siril_cat_in' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`siril_cat_in` is only read in this function: its `nbitems` and `cat_items[i]` fields are read, and `siril_cat_in->cat_items + i` is passed to `siril_catalogue_copy_item`. Declaring the parameter as `const siril_catalogue *` only makes the `cat_items` pointer member const, not the items it points to. So passing `cat_items + i` to a function that takes a non-const `cat_item*` still compiles. The original constParameterPointer warning was therefore a true positive. The PR now treats `+` with an unknown valueType as pointer arithmetic, so the argument is attributed to the function call and the warning is suppressed. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/skalibs/skalibs_2.16.0.0.orig.tar.gz", "main skalibs-2.16.0.0/src/libstddjb/sagethostname.c:24:14: style: Condition '!sa->s[sa->len+n-2]' is always true [knownConditionTrueFalse]\n skalibs-2.16.0.0/src/libstddjb/sagethostname.c:18:30: note: Assignment 'sa->s[sa->len+n-2]=0', assigned value is 0\n skalibs-2.16.0.0/src/libstddjb/sagethostname.c:24:14: note: Condition '!sa->s[sa->len+n-2]' is always true" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "Line 18 sets the byte to 0, then `gethostname(sa->s + sa->len, n)` writes the hostname into that buffer. The byte checked on line 24 can therefore be non-zero, so 'always true' was a false positive. The stralloc type comes from a skalibs header that Cppcheck probably did not resolve, so the `+` expression likely had no valueType. Before the PR, getTokenArgumentFunction did not treat the pointer as passed to gethostname in that case. Now it does, so the write through the argument is considered and the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/skalibs/skalibs_2.16.0.0.orig.tar.gz", "main skalibs-2.16.0.0/src/libstddjb/stralloc_reverse_blocks.c:6:41: style: Parameter 'sa' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The function only writes through the member pointer `sa->s` (`memcpy(sa->s + ...)`). It never modifies the `stralloc` struct itself. Declaring `const stralloc *sa` would therefore still compile, since `sa->s` becomes `char * const` and remains writable. That makes the removed warning technically a true positive, consistent with Cppcheck's usual constParameterPointer semantics. The PR now skips over `+`/`-` when its value type is unknown (here the stralloc type likely comes from an unresolved header). As a result, `sa->s + i*size` is treated as a non-const argument to `memcpy`, and the warning disappears. This is a new false negative, traded for fixing false positives like #15226." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/slic3r-prusa/slic3r-prusa_2.9.7+dfsg.orig.tar.xz", "main PrusaSlicer-version_2.9.7/bundled_deps/avrdude/avrdude/ser_posix.c:81:24: style: Variable 'map' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In `serial_baud_lookup`, `map` is only read (`map->baud`, `map->speed`) and incremented, so it could be `const struct baud_mapping *`. The warning was a true positive. The function returns `speed_t` by value, but that typedef comes from a system header Cppcheck cannot see. With the PR passing `unknown=true` to `returnsReference`, the unknown return type is now treated as a possible reference, so the `return map->speed` path suppresses the warning. That is a new false negative, accepted as a trade-off for avoiding false positives." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/slic3r-prusa/slic3r-prusa_2.9.7+dfsg.orig.tar.xz", "main PrusaSlicer-version_2.9.7/src/libslic3r/Fill/FillGyroid.cpp:93:19: style: Variable 'rp' can be declared as reference to const [constVariableReference]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`rp` is only read: `rp(0)` and `ip - rp`. It is never modified, so declaring it `const auto&` would be valid and the warning was a true positive. The PR now walks past a `-` operator whose valueType is unknown (Eigen `Vec2d` arithmetic). That makes `rp` look like an argument to the `Vec2d(...)` call, so the warning is suppressed. This is a new false negative, accepted in exchange for fixing the pointer-arithmetic false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/slic3r-prusa/slic3r-prusa_2.9.7+dfsg.orig.tar.xz", "main PrusaSlicer-version_2.9.7/src/slic3r/GUI/GUI_Preview.cpp:586:51: performance:inconclusive: Function parameter 'val' should be passed by const reference. [passedByValue]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The lambda parameter `CustomGCode::Item val` is only read (`val.print_z`). Item holds std::string members, so passing it by value copies strings needlessly, and the passedByValue warning was a true positive. The PR now skips a `+`/`-` parent whose valueType is unknown, treating it as possible pointer arithmetic. So `val.print_z - CustomGCode::epsilon()` is seen as `val` being passed to `std::lower_bound`, which suppresses the warning even though the subtraction yields a temporary double. Losing this true positive is a new false negative." } } ], "started": "2026-11-27 21:21:14 UTC", "runner": "pc" }