MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Pages: 1

MASH
MASH
Reged: 09/26/03
Posts: 1781
Loc: Germany
Send PM


Cppcheck a tool for MAME C/C++ code analysis :)
#266112 - 10/12/11 12:47 AM Attachment: cppcheck-MAME.png 49 KB (1 downloads)


Cppcheck is a static analysis tool for C/C++ code. Cppcheck does not detect syntax errors
like C/C++ compilers but tries to detect bugs that are not visible by the compiler
like memory leaks or out of bounds.

Cppcheck is a command line tool but don’t panic, a GUI is also available. With Cppcheck,
you can analyze a single file or the content of a whole folder.


Homepage:
http://cppcheck.sourceforge.net/

Cppcheck 1.50 Win32 installer:
http://downloads.sourceforge.net/cppcheck/cppcheck-1.50-x86-Setup.msi

I've tested Cppchec with MAME source and the program found errors!

[ATTACHED IMAGE - CLICK FOR FULL SIZE]

Attachment



Bryan Ischo
MAME Fan
Reged: 03/28/10
Posts: 358
Send PM


Re: Cppcheck a tool for MAME C/C++ code analysis :) new [Re: MASH]
#266117 - 10/12/11 02:04 AM


You really need to say exactly what version of MAME you ran that tool against.

For example, I looked at the warning for emu/addrmap.c and the m_submap_bits field doesn't even exist in address_map_entry in the version I have, which is MAME 0.143.

The 'information' and 'style' 'Schweregrad' entries (whatever that is) are totally irrelevant.

The warnings for emu/drawgfx.h do look serious but I have a feeling that the class in question is only ever created via a new operator which zeroes memory. I don't know for sure but it feels like it would be very MAME-like to have every C++ constructor invoke a version of new that used calloc. Someone else would have to validate this though as I don't have the time at this exact moment to look that up.



redk9258
Regular
Reged: 09/21/03
Posts: 3968
Loc: Troy, Illinois USA
Send PM


Re: Cppcheck a tool for MAME C/C++ code analysis :) new [Re: Bryan Ischo]
#266122 - 10/12/11 02:35 AM


> You really need to say exactly what version of MAME you ran that tool against.

My guess is 0.143u7, since that's what's current..



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9717
Loc: ECV-197 The Orville
Send PM


Re: Cppcheck a tool for MAME C/C++ code analysis :) new [Re: Bryan Ischo]
#266124 - 10/12/11 02:56 AM


None of what's listed is a problem. We get better diagnostics compiling with top-of-tree Clang.


Pages: 1

MAMEWorld >> EmuChat
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 250 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 1996