[haiku-commits] r35432 - in haiku/trunk/3rdparty: . cppcheck

  • From: aljen-mlists@xxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 8 Feb 2010 21:39:53 +0100 (CET)

Author: aljen
Date: 2010-02-08 21:39:52 +0100 (Mon, 08 Feb 2010)
New Revision: 35432
Changeset: http://dev.haiku-os.org/changeset/35432/haiku

Added:
   haiku/trunk/3rdparty/cppcheck/
   haiku/trunk/3rdparty/cppcheck/checksources.pl
   haiku/trunk/3rdparty/cppcheck/haiku.lst
Log:
Added cppcheck wrapped for use with Haiku sources (it's a tool for static c/c++ 
code analysis)

Added: haiku/trunk/3rdparty/cppcheck/checksources.pl
===================================================================
--- haiku/trunk/3rdparty/cppcheck/checksources.pl                               
(rev 0)
+++ haiku/trunk/3rdparty/cppcheck/checksources.pl       2010-02-08 20:39:52 UTC 
(rev 35432)
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+use File::Basename;
+use File::Find;
+
+if (scalar @ARGV < 2) {
+       die "Usage: $0 <dir to check> <file to log> <optional number of 
jobs>\n";
+}
+
+if (!-e "./ReadMe.cross-compile") {
+       die "ERROR: $0 must be called from Haiku top directory!\n";
+}
+
+my %headers;
+my $dirToCheck = shift @ARGV;
+my $fileToLog = shift @ARGV;
+my $jobs = 1;
+if (scalar @ARGV) {
+       $jobs = shift @ARGV;
+}
+my $headersDirs;
+my $cppcheck;
+
+print "Scanning headers...\n";
+find({ wanted => \&process, no_chdir => 1},
+       ("headers/posix", "headers/libs", "headers/os", "headers/private"));
+
+foreach my $dir (sort keys %headers) {
+       $headersDirs .= "-I $dir ";
+}
+
+print "Running cppcheck tool...\n";
+$cppcheck = "cppcheck -j $jobs --force --auto-dealloc 
3rdparty/cppcheck/haiku.lst --enable=exceptRealloc,possibleError,style 
$headersDirs $dirToCheck 2> $fileToLog";
+
+system($cppcheck);
+
+sub process
+{
+       if (substr($_, -4, 4) eq '.svn') {
+               $File::Find::prune = 1;
+       } else {
+               return if $File::Find::dir eq $_;       # skip toplevel folders
+               my $name = (fileparse($_))[0];
+               if (-d $_) {
+                       push @{$headers{$File::Find::name}->{subdirs}}, $name;
+                       return;
+               }
+       }
+}
+


Property changes on: haiku/trunk/3rdparty/cppcheck/checksources.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: haiku/trunk/3rdparty/cppcheck/haiku.lst
===================================================================
--- haiku/trunk/3rdparty/cppcheck/haiku.lst                             (rev 0)
+++ haiku/trunk/3rdparty/cppcheck/haiku.lst     2010-02-08 20:39:52 UTC (rev 
35432)
@@ -0,0 +1,17 @@
+BAlert
+BButton
+BCheckBox
+BControl
+BMenuBar
+BMenuField
+BMenuItem
+BMenuWindow
+BPopUpMenu
+BRadioButton
+BScrollBar
+BSplitView
+BStringView
+BTextControl
+BView
+BWindow
+


Other related posts:

  • » [haiku-commits] r35432 - in haiku/trunk/3rdparty: . cppcheck - aljen-mlists