2013/07/16

Cppcheck の巻

Clang Static Analyzer に続き、Haiku クロスビルド環境の Ubuntu でも静的解析という事で、Cppcheck を入れて見ました。

Ubuntu からだと、apt-get で入ります。
haiku@haiku:~$ sudo apt-get install cppcheck
試しに、Mail をチェックして見ました。ビルドなしで、ディレクトリ単位でチェックできるので楽ですね。Cppcheck に与えるオプションにはもっと工夫の余地があるようです。
haiku@haiku:~$ cppcheck --enable=all -q -I /home/haiku/haiku/haiku/headers /home/haiku/haiku/haiku/src/apps/mail
[/home/haiku/haiku/haiku/src/apps/mail/ButtonBar.cpp:128]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/ButtonBar.cpp:137]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/ButtonBar.cpp:219]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/ButtonBar.cpp:231]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/ButtonBar.cpp:210]: (error) Common realloc mistake: 'fDividerArray' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:1534]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:2486]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:862]: (warning) Member variable 'TTextView::fFile' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:1113]: (error) Common realloc mistake: 'fYankBuffer' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:2529]: (error) Common realloc mistake: 'buffer' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/Content.cpp:3151]: (error) Common realloc mistake: 'target' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/Enclosures.cpp:222]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Enclosures.cpp:243]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Enclosures.cpp:287]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Enclosures.cpp:151]: (warning) Member variable 'TEnclosuresView::fWindow' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Header.cpp:947]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/KUndoBuffer.cpp:17]: (error) Possible null pointer dereference: RedoText - otherwise it is redundant to check if RedoText is null at line 18
[/home/haiku/haiku/haiku/src/apps/mail/KUndoBuffer.cpp:93]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/KUndoBuffer.cpp:100]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/KUndoBuffer.cpp:42]: (error) Common realloc mistake: 'RedoText' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/MailApp.cpp:343]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:986]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:988]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:2414]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:2636]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:2982]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:846]: (style) The scope of the variable 'enable' can be reduced
[/home/haiku/haiku/haiku/src/apps/mail/MailWindow.cpp:2529]: (style) The scope of the variable 'flags' can be reduced
[/home/haiku/haiku/haiku/src/apps/mail/QueryMenu.cpp:244]: (style) C-style pointer casting
[/home/haiku/haiku/haiku/src/apps/mail/Signature.cpp:343]: (style) The scope of the variable 'index' can be reduced
[/home/haiku/haiku/haiku/src/apps/mail/Signature.cpp:407]: (warning) Member variable 'TSignatureView::fName' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Signature.cpp:407]: (warning) Member variable 'TSignatureView::fTextView' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Signature.cpp:407]: (warning) Member variable 'TSignatureView::fOffset' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Signature.cpp:513]: (warning) Member variable 'TSigTextView::fParent' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/Status.cpp:130]: (style) The scope of the variable 'index' can be reduced
[/home/haiku/haiku/haiku/src/apps/mail/WIndex.cpp:149]: (warning) Member variable 'WIndex::fIsSorted' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/WIndex.cpp:138]: (warning) Member variable 'WIndex::fIsSorted' is not initialized in the constructor.
[/home/haiku/haiku/haiku/src/apps/mail/WIndex.cpp:271]: (error) Common realloc mistake: 'fEntryList' nulled but not freed upon failure
[/home/haiku/haiku/haiku/src/apps/mail/ComboBox.cpp:1300]: (style) The function 'GetAlignment' is never used
[/home/haiku/haiku/haiku/src/apps/mail/ComboBox.cpp:1316]: (style) The function 'ModificationMessage' is never used
(information) Cppcheck cannot find all the include files (use --check-config for details)

 

0 件のコメント:

コメントを投稿