linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: rpjday@crashcourse.ca (Robert P. J. Day)
To: linux-arm-kernel@lists.infradead.org
Subject: apparently, numerous unused header files under arch/arm
Date: Wed, 30 Sep 2009 14:21:57 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0909301416560.20750@localhost> (raw)
In-Reply-To: <20090930144603.GC25416@huya.quicinc.com>

On Wed, 30 Sep 2009, David Brown wrote:

> On Wed, Sep 30, 2009 at 01:12:22AM -0700, Robert P. J. Day wrote:
>
> > is there any interest in my posting that arm-specific list
> > somewhere and people can peruse it and decide what, if anything,
> > they want to do with it?
>
> Any chance the script itself could be made available?  I would find
> this useful as I'm working through large amounts of code to get it
> to a state where it can be sent out as patches.

  an embarrassingly brute force approach -- most of my scripts are
just tweaked variations of the following.  run from whatever
location you want, and customize to taste:

===== start script =====

#!/bin/sh

#  This script should always be run from the *top* of the kernel
# source tree.
#
#  Typical usage:
#
#  $ find_unused_headers.sh sound
#
#  Make sure you run some version of "make clean" before running
# this script.

DIR=${1-*}     # optional dir to scan, otherwise "."

#  Make a list of all of the header files in the given directory
# structure, and rip off their basenames.

LONGHDRS=$(find ${DIR} -name "*.h")

HDRS=""

for h in ${LONGHDRS} ; do
	HDRS="${HDRS} $(basename ${h})"
done

#
#  just for fun, process them in sorted order
#

HDRS=$(for h in ${HDRS} ; do echo $h ; done | sort -u)

# echo "${HDRS}"

#
#  Test that each header file is included from *somewhere*.
#

for h in ${HDRS} ; do
	# echo "Testing $h ..."
	egrep -rwq " *# *include.*\b${h}\b" * || {
		echo "===== ${h} ====="
		find . -name "${h}"
		grep -rwH ${h} *
	}
done

===== end script =====

  that last "grep" is simply to scan the *entire* source tree, looking
for that header file name *anywhere*, and that's what might reveal
that it's being used by something somewhere else, like in a Makefile.

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================

  reply	other threads:[~2009-09-30 18:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30  8:12 apparently, numerous unused header files under arch/arm Robert P. J. Day
2009-09-30 14:46 ` David Brown
2009-09-30 18:21   ` Robert P. J. Day [this message]
2009-09-30 14:47 ` Bill Gatliff
2009-09-30 15:15   ` Robert P. J. Day

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.0909301416560.20750@localhost \
    --to=rpjday@crashcourse.ca \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).