Jump to content

cppcheck


Guest kupix_

Recommended Posts

there are few really nice tools to analyze source code. i have checked lately cppcheck (more info about it here) on mangos zero server (with scriptdev0 in src/bindings/ dir).

log is available at github. there are mostly "C-style pointer casting" informations but also can be found really interesting ones ("(error) Memory leak:").

it has been run on latest code.

if you want to run it too, be prepered to wait for a F*CKING LONG TIME (way much longer then generating vmaps/mmaps/dbc's all together). it took me about 10 hours or so (while im generating vmaps about 10 minutes or less). you have been warned ;-)

btw, it can be used to some code cleanups. maybe students of [MaNGOS University] would like to look at it and can try to fix something.

have fun, kupix

Link to comment
Share on other sites

Thanks a bunch for this way cool tool!

The processing time is mind-boggling, but I supposed that it is no surprise when you look at the tens of thousands of lines in the core code.

I think your suggestion to use it as a learning aid for MaNGOS University students is a genius idea! :D

Please feel free to post a few of your favorite examples in the university, to get things started, or even write a tutorial on using cppcheck with the MaNGOS core.

Link to comment
Share on other sites

it can be used from time to time to check the code. it takes too long to see effect (silly me, my cppcheck was running on one core, but it can be run on more cores so it can be faster (need to confirm it), next time i'll try to read manual from carefully).

it can be cloned from github.

there is somekind of gui (qt is used for it). but i haven't test it (just wasn't able to compile it with gui mode).

compiling for console works like this (n = number of cores)

make -j n && make install

more options for compilation process are also available. check in cppcheck manual.

usage is also simple:

cppcheck --enable=all -j n server/ 2> logfile.log

--enable=all is responsible for all kind of checks, like style, mem leaks...

-j n is responsible for running as multithreaded (where n is num of cores)

2> logfile.log moves errors (or better: check log) into file logfile.log

server/ is catalog with source code to check

i also have been using --silent parameter (im not sure if it's correct name). so the program is running in background without console output like: checking FileName.... but this parameter can be skiped.

For mangos university students, definitely the easiest part to check and replace could be style warning like "c-like casting". But also errors with memory leaks can be check'd (usually not closed file).

Skip messages from ACE framework. Rest also might be "repaired".

Yesterday i've been checking code with some commersial tool (pvs-studio, it is only available on windows). i'll try to commit those logs too.

Anyway, have fun with log analyzing ;)

Edit:

output logs from pvs-studio

server

scriptdev0

kupix

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use