mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +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> |
||
---|---|---|
.. | ||
aio.cpp | ||
bezier.cpp | ||
blocklist_driver.cpp | ||
bytes_be.cpp | ||
color.cpp | ||
compression.cpp | ||
csv.cpp | ||
datafile.cpp | ||
fs.cpp | ||
git_revision.cpp | ||
hash.cpp | ||
huffman.cpp | ||
io.cpp | ||
jobs.cpp | ||
json.cpp | ||
mapbugs.cpp | ||
name_ban.cpp | ||
net.cpp | ||
netaddr.cpp | ||
os.cpp | ||
packer.cpp | ||
prng.cpp | ||
score.cpp | ||
secure_random.cpp | ||
serverbrowser.cpp | ||
serverinfo.cpp | ||
str.cpp | ||
strip_path_and_extension.cpp | ||
teehistorian.cpp | ||
test.cpp | ||
test.h | ||
thread.cpp | ||
unix.cpp | ||
uuid.cpp |