Giacomo Catenazzi <[EMAIL PROTECTED]>:
> The main point is: Could we find easily all
> 'orphaned file' with the new kbuild-2.5?
> (outside Documentation, it sould be few README and
> some skeletons, no more 'orphaned' files).
My piece of kbuild-2.5 includes a cross-reference analyzer called kxref.c that
can do this. The report you want would be to show all CONFIG symbols that
occur in C but not in Makefiles:
scripts/kxref -l -f "c&~m"
Here is the header comment:
This is a report generator intended to catch problems and inconsistencies
in the configuration-symbol namespace. It uses information generated by
the CML2 compiler -- notably, it relies on the compiler's scanning of
help files.
All this does is generate cross-reference reports on configuration
symbols. But they can be filtered and presented in various
interesting ways. Basic usage is like this:
kxref.py [-e | -f filter | -h] [-l] [-x symbol] [-n re] [sourcetree]
You can set a filter using a boolean-expression minilanguage. The predicates
available are as follows:
c -- select all symbols present in code (.c, .h, .S files)
m -- select all symbols present in makefiles
n -- select all symbols defined in CML2 rulesfiles
h -- select all symbols for which help is available
d -- select all symbols that occur in defconfigs
x -- select all symbols that are derived in CML2.
p -- select all symbols that are private in CML2.
o -- select all symbols present in CML1 configuration files
a -- select all symbols declared in CML1 configuration files
Operations available are as follows:
& -- and (set intersection)
| -- or (set intersection)
~ -- not (set complement).
You may use parentheses for expression grouping.
The most interesting report is probably ~((c|m)&(h|x)&o), which flags
all "exceptional" symbols -- that is, everything that doesn't both
occurs in code or makefiles, and either has help or is derived, and
occur in a CML1 configuration file. When the configuration system is
properly cleaned up this set should be empty. This is the filter you
get if you specify -e.
This program caches a cross-reference database in a file named
xref.out, So all reports after the first are generated really fast.
You should remove this file whenever you apply a patch.
The -i option inverts the report so it's keyed by file, rather than
by symbol.
The -g option generates a patch removing file lines containing the
reported (presumably orphaned) symbols. Use with caution...it's
really only safe for hacking defconfigs.
The -x option is for debugging. It generates a report on an individual
symbol specified as an argument to the option. Flag letters are as
above, with f= giving the value of the computed filter predicate.
The -h option checks for duplicate or superfluous file inclusions
in the source tree.
The -l switch suppresses printing printing of cross-references;
only symbols matching the given filter(s) are listed.
The -n suppresses listing of files matching the given regexp.
If all the files a symbol occurs in are excluded, it will be omitted
from the listings.
The -t option produces a listing of symbols which either have
inconsistent CML1 types or types that differ between CML1 and CML2.
The program has some knowledge of file syntax. It ignores the
contents of comments in C, CML1, and CML2 files (e.g. does not
cross-reference symbols in such comments).
Some interesting reports:
n&~p&~a -- identifies CML2 symbols no longer declared or defined in CML1
--
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>
Sometimes the law defends plunder and participates in it. Sometimes the law
places the whole apparatus of judges, police, prisons and gendarmes at the
service of the plunderers, and treats the victim -- when he defends himself --
as a criminal. -- Frederic Bastiat, "The Law"
_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel