diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-12-01 16:28:01 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-12-01 16:28:01 -0500 |
commit | fb6962e856a3d2db72053bad60d16aeffd50e072 (patch) | |
tree | dffc8b21c75e7ddda0ae90a674cbe01fc407cccc | |
parent | 1a8c525d7fb3c00c373a80a40306e32221836362 (diff) | |
download | deheader-fb6962e856a3d2db72053bad60d16aeffd50e072.tar.gz deheader-fb6962e856a3d2db72053bad60d16aeffd50e072.tar.bz2 deheader-fb6962e856a3d2db72053bad60d16aeffd50e072.tar.xz deheader-fb6962e856a3d2db72053bad60d16aeffd50e072.zip |
Add documentation, the beginnings of a test suite, a logo, an shipper control.
-rw-r--r-- | COPYING | 28 | ||||
-rw-r--r-- | Makefile | 45 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | README | 9 | ||||
-rw-r--r-- | control | 18 | ||||
-rwxr-xr-x | deheader | 2 | ||||
-rw-r--r-- | deheader-logo.png | bin | 0 -> 959 bytes | |||
-rw-r--r-- | deheader.xml | 105 | ||||
-rw-r--r-- | test/README | 2 | ||||
-rw-r--r-- | test/noheaders.c | 5 | ||||
-rw-r--r-- | test/regress.chk | 1 | ||||
-rw-r--r-- | test/string.c | 6 |
12 files changed, 225 insertions, 0 deletions
@@ -0,0 +1,28 @@ + BSD LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +Neither name of the this project nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..06ef51e --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +# +# makefile for `deheader' +# +VERS=$(shell sed <deheader -n -e '/version\s*=\s*"\(.*\)"/s//\1/p') + +SOURCES = README COPYING NEWS deheader deheader.xml deheader.1 Makefile control deheader.png + +all: deheader.1 + +deheader.1: deheader.xml + xmlto man deheader.xml + +deheader.html: deheader.xml + xmlto html-nochunks deheader.xml + +clean: + rm -f *~ *.1 *.html test/*.o MANIFEST SHIPPER.* + +regress: + @echo "Testing deheader: no output is good news." + @deheader test >/tmp/regress + @diff -u test/regress.chk /tmp/regress + @rm /tmp/regress +makeregress: + @deheader test >test/regress.chk + +pychecker: + @ln -f deheader deheader.py + @-pychecker --only --limit 50 deheader.py + @rm -f deheader.py* + +version: + @echo $(VERS) + +deheader-$(VERS).tar.gz: $(SOURCES) + @ls $(SOURCES) | sed s:^:deheader-$(VERS)/: >MANIFEST + @(cd ..; ln -s deheader deheader-$(VERS)) + (cd ..; tar -czf deheader/deheader-$(VERS).tar.gz `cat deheader/MANIFEST`) + @ls -l deheader-$(VERS).tar.gz + @(cd ..; rm deheader-$(VERS)) + +dist: deheader-$(VERS).tar.gz + +release: deheader-$(VERS).tar.gz deheader.html + shipper -u -m -t; make clean @@ -0,0 +1,4 @@ + deheader project news + +0.1 @ 2010-12-01 + Initial release. @@ -0,0 +1,9 @@ + deheader + +deheader analyzes C and C++ files to determine which header enclusions can be +removed while still allowing them to compile. This may result in substantial +improvements in compilation time, especially on large C++ projects; it also +sometime exposes dependencies and cohesions of which developers were unaware. + + Eric S. Raymond + December 2010 @@ -0,0 +1,18 @@ +# This is not a real Debian control file +# It's project metadata for the shipper tool + +Package: deheader + +Description: lift documents in nroff markups to XML-DocBook + deheader analyzes C and C++ files to determine which header enclusions can be + removed while still allowing them to compile. This may result in substantial + improvements in compilation time, especially on large C++ projects; it also + sometime exposes dependencies and cohesions of which developers were unaware. + +XBS-Destinations: freshmeat + +Homepage: http://www.catb.org/~esr/deheader + +XBS-Logo: deheader-logo.png + +XBS-Project-Tag-List: development tools, optimization, C, C++ @@ -30,6 +30,8 @@ BATON_DEBUG = 1 PROGRESS_DEBUG = 2 COMMAND_DEBUG = 3 +version = "0.1" + class Baton: "Ship progress indications to stderr." def __init__(self, prompt, endmsg=None): diff --git a/deheader-logo.png b/deheader-logo.png Binary files differnew file mode 100644 index 0000000..ea81be2 --- /dev/null +++ b/deheader-logo.png diff --git a/deheader.xml b/deheader.xml new file mode 100644 index 0000000..10ec5d8 --- /dev/null +++ b/deheader.xml @@ -0,0 +1,105 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE refentry PUBLIC + "-//OASIS//DTD DocBook XML V4.1.2//EN" + "docbook/docbookx.dtd"> +<refentry id='deheader.1'> +<refmeta> +<refentrytitle>deheader</refentrytitle> +<manvolnum>1</manvolnum> +<refmiscinfo class='date'>Dec 01 2010</refmiscinfo> +<refmiscinfo class='productname'>deheader</refmiscinfo> +<refmiscinfo class='source'>deheader</refmiscinfo> +<refmiscinfo class='manual'>Development Tools</refmiscinfo> +</refmeta> +<refnamediv id='name'> +<refname>deheader</refname> +<refpurpose>report which includes in C or C++ compiles can be removed</refpurpose> +</refnamediv> +<refsynopsisdiv id='synopsis'> + +<cmdsynopsis> + <command>deheader</command> + <arg choice='opt'>-h </arg> + <arg choice='opt'>-m </arg> + <arg choice='opt'>-i </arg> + <arg choice='opt'>-r </arg> + <arg choice='opt'>-v </arg> + <arg choice='opt'><replaceable>file-or-dir</replaceable></arg> +</cmdsynopsis> +</refsynopsisdiv> + +<refsect1 id='description'><title>DESCRIPTION</title> + +<para>This tool takes a list of C or C++ sourcefiles and generates a +report on which #includes can be omitted from them. The test, for each +foo.c or foo.cc or foo.cpp, is simply whether 'rm foo.o; make foo.o' +returns a zero status (but the build command may be +overridden). Optionally, with the <option>-r</option> switch, the +unneeded headers are removed from the sourcefiles.</para> + +<para>If a sourcefile argument is a directory, the report is generated +on all source files beneath it. Subdirectories beginning with a dot +are assumed to be repository directories for version-control systems +and ignored. If no arguments are given, the program runs as if the +name of the current directory had been passed to it.</para> + +<para>On each test compile, the original sourcefile is moved to a name +with an .orig suffix and restored on interrupt or after processing +with its original timestamp, unless the <option>-r</option> option was +given and headers removed.</para> + +<para>At verbosity level 0, only messages indicating removable headers +are issued. At verbosity 1, test compilations are timed and progess +indicated with a twirling-baton prompt. Higher levels enable more +detailed progress messages and are mainly useful for debugging this +program.</para> +</refsect1> + +<refsect1 id='options'><title>OPTIONS</title> +<variablelist> +<varlistentry> +<term>-h</term> +<listitem> +<para>Display some help and exit.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>-m</term> +<listitem> +<para>Set the build command used for test compiles. Defaults to 'make'.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>-i</term> +<listitem> +<para>Set a pattern for includes to be ignored. +Takes a Python regular expression.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>-r</term> +<listitem> +<para>Remove header inclusions from sourcefiles where they are not required.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>-v</term> +<listitem> +<para>Set verbosity.</para> +</listitem> +</varlistentry> +<varlistentry> +<term>-V</term> +<listitem> +<para>Show version of program snd exit.</para> +</listitem> +</varlistentry> +</variablelist> +</refsect1> + +<refsect1 id='author'><title>AUTHOR</title> +<para>Eric S. Raymond <email>esr@snark.thyrsus.com</email>; (home page at <ulink +url='http://www.catb.org/~esr/'>http://www.catb.org/~esr/</ulink>).</para> +</refsect1> +</refentry> + diff --git a/test/README b/test/README new file mode 100644 index 0000000..215687e --- /dev/null +++ b/test/README @@ -0,0 +1,2 @@ +This directory contains C sourcfiles intended to terst deheder, and +a check against which to compare tthe output. diff --git a/test/noheaders.c b/test/noheaders.c new file mode 100644 index 0000000..d245179 --- /dev/null +++ b/test/noheaders.c @@ -0,0 +1,5 @@ +/* this filre has no headers and needs none */ + +main(int arg, char **argv) +{ +} diff --git a/test/regress.chk b/test/regress.chk new file mode 100644 index 0000000..ecff26c --- /dev/null +++ b/test/regress.chk @@ -0,0 +1 @@ +deheader: remove <string.h> from test/string.c diff --git a/test/string.c b/test/string.c new file mode 100644 index 0000000..3f75878 --- /dev/null +++ b/test/string.c @@ -0,0 +1,6 @@ +/* this file has string.h but doesn't need it */ + +#include <string.h> +main(int arg, char **argv) +{ +} |