cppcheck 2.2 complains about many `ifdef`s in the Debugger plugin: ``` make[5]: Leaving directory '/build/geany-plugins-1.36-1+20201013git06a38f4/debugger/src' tpage.c:154:62: warning: Uninitialized variable: widgets [uninitvar] gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(*widgets[i])), *widgets[i]); ^ nofile:0:0: warning: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]
make[4]: *** [Makefile:1686: check-cppcheck] Error 2 ```
When we remove GTK2 code, this might resolve it.
What should we do until then? - use `--force`? - refactor the code? - ignore?
This breaks the nightly builds for Debian Sid: https://www.geany.org/download/nightly-builds/.
For the ifdef IIUC cppcheck checks all possible paths through nested `#ifdefs` eg:
``` #ifdef A code 1 #else code 2 #endif ```
would have the whole file checked twice, once with code 1 and once with code 2 included, but when ifdefs are nested the number of combinations can explode and the check time blow out (one project had their CI run for weeks trying to complete it) so the number of combinations is limited by default.
Maybe best to skip cppcheck on debugger until after 1.37 rather than making big changes to it this close to release.
Extra points for running `cppcheck --force` on debugger manually to see how long it takes :)
Is the problem really the ifdefs, or the `widgets` variable? If it's the var, it looks like a false positive to me.
I was just going on the title of the issue, I'm sure @eht16 couldn't be wrong. :)
And agree the variable is a false positive, the `widgets` array is an initialised static null terminated in a loop that stops on null.
Also most of the ifdefs are `GTK_CHECK_VERSION(3, 0, 0)` and I don't know how smart cppcheck is to know all instances of that macro will have the same value.
Oops, even in the log I pasted here I completely overlooked the real error message and just concentrated on the (probably) harmless warning. My random excuse generator says: it was late.
Maybe restructure the widgets loop as a `for()` and cppcheck might recognise it better?
Maybe restructure the widgets loop as a `for()` and cppcheck might recognise it better?
Tried but didn't help and would be even worse as you first need to know the array size. #1017 fixes the `cppcheck` warning which actually seems to be a false positive, `cppcheck` gets confused about the pointer dereferencing.
Closed #1014 via #1017.
github-comments@lists.geany.org