1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/usr/bin/perl -w use strict; my @macros = (); open(F, 'orconfig.h.in'); while(<F>) { if (/^#undef +([A-Za-z0-9_]*)/) { push @macros, $1; } } close F; for my $m (@macros) { my $s = `git grep '$m' src`; if ($s eq '') { print "Unused: $m\n"; } }