mirror of
https://github.com/ddnet/ddnet.git
synced 2024-10-20 07:48:18 +00:00
cf6e89c319
6035: Fix various issues reported by cppcheck static analyser r=def- a=Robyt3 After generating `compile_commands.json` with cmake, I ran [cppcheck](https://cppcheck.sourceforge.io/) like this: ``` cppcheck --project=compile_commands.json -DWIN64 --suppressions-list=cppcheck.supp --enable=all 2>cppcheck.log ``` With these suppressions in `cppcheck.supp`: ``` cstyleCast useStlAlgorithm unusedFunction variableScope noExplicitConstructor useInitializationList noConstructor uninitMemberVar uninitMemberVarPrivate uninitDerivedMemberVar uninitStructMember uninitvar shadowFunction memleakOnRealloc internalAstError virtualCallInConstructor unknownMacro noOperatorEq noCopyConstructor ``` Many of these occur too often or are false positives. Here is a list of all remaining non-suppressed issues reported by cppcheck: [cppcheck.log](https://github.com/ddnet/ddnet/files/9997663/cppcheck.log) And here is a list of all remaining issues including the suppressed ones: [cppcheck_all.log](https://github.com/ddnet/ddnet/files/9997662/cppcheck_all.log) I couldn't get cppcheck's command line argument to ignore the external folders to work correctly, so I manually removed those entries from the files. ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Robert Müller <robytemueller@gmail.com> |
||
---|---|---|
.. | ||
backend | ||
backend_sdl.cpp | ||
backend_sdl.h | ||
blocklist_driver.cpp | ||
blocklist_driver.h | ||
checksum.h | ||
client.cpp | ||
client.h | ||
demoedit.cpp | ||
demoedit.h | ||
discord.cpp | ||
favorites.cpp | ||
friends.cpp | ||
friends.h | ||
ghost.cpp | ||
ghost.h | ||
graphics_defines.h | ||
graphics_threaded.cpp | ||
graphics_threaded.h | ||
input.cpp | ||
input.h | ||
keynames.h | ||
notifications.cpp | ||
notifications.h | ||
serverbrowser.cpp | ||
serverbrowser.h | ||
serverbrowser_http.cpp | ||
serverbrowser_http.h | ||
serverbrowser_ping_cache.cpp | ||
serverbrowser_ping_cache.h | ||
sound.cpp | ||
sound.h | ||
sqlite.cpp | ||
steam.cpp | ||
text.cpp | ||
updater.cpp | ||
updater.h | ||
video.cpp | ||
video.h |