[PATCH 02] find_unused_macros: Remove obsolete script that finds unused macros.

Jelmer Vernooij jelmer at samba.org
Fri Aug 29 17:50:36 MDT 2014


There are various static checkers that can do this nowadays, with
better accuracy.

Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
---
 source4/script/find_unused_macros.pl | 38 ------------------------------------
 1 file changed, 38 deletions(-)
 delete mode 100755 source4/script/find_unused_macros.pl

diff --git a/source4/script/find_unused_macros.pl b/source4/script/find_unused_macros.pl
deleted file mode 100755
index 8886835..0000000
--- a/source4/script/find_unused_macros.pl
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/perl
-# Script that reads in C files and prints defines that are used nowhere in the 
-# code
-
-# Arguments: C and H files
-# Copyright Jelmer Vernooij <jelmer at samba.org>, GPL
-
-use strict;
-
-my %defined;
-my %used;
-my %files;
-
-my $tmp;
-while($tmp = shift) { 
-	$files{$tmp} = $tmp;
-	open(FI, $tmp);
-	my $ln = 0;
-	while(<FI>) { 
-		$ln++;
-		my $line = $_;
-		my $cur = "";
-		if(/^#define ([A-Za-z0-9_]+)/) {
-			$defined{$1} = "$tmp:$ln";
-			$cur = $1;
-		}
-
-		$_ = $line;
-		while(/([A-Za-z0-9_]+)/sgm) { 
-			if($cur ne $1) { $used{$1} = "$tmp:$ln"; }
-		}
-	}
-	close FI;
-}
-
-foreach(keys %defined) {
-	if(!$used{$_}) { print "$defined{$_}: Macro `$_' is unused\n"; }
-}
-- 
2.1.0



More information about the samba-technical mailing list