Add 'contrib/unifdef/' from commit '0da44885831dc0a43c4ca6ff04a2430993cc0a80'

git-subtree-dir: contrib/unifdef
git-subtree-mainline: 3b7ffacdee
git-subtree-split: 0da4488583
This commit is contained in:
Dag-Erling Smørgrav 2023-08-21 19:51:03 +02:00
commit fb3ef04d20
442 changed files with 6545 additions and 0 deletions

7
contrib/unifdef/.gitignore vendored Normal file
View file

@ -0,0 +1,7 @@
Changelog
unifdef
unifdef.exe
unifdef.txt
unifdef-*
version.h
version.sh

View file

@ -0,0 +1,59 @@
language: c
sudo: false
os:
- linux
- osx
compiler:
- gcc
- clang
matrix:
include:
## Ubuntu 14.04 Trusty (beta), sudo required!
- os: linux
dist: trusty
sudo: required
compiler: gcc
env: TRUSTY="yes"
- os: linux
dist: trusty
sudo: required
compiler: clang
env: TRUSTY="yes"
## MinGW / wine
- os: linux
sudo: required
compiler: i586-mingw32msvc-gcc
env: BUILD_MINGW="yes"
allow_failures:
- compiler: i586-mingw32msvc-gcc
install:
- env | grep -v "encrypted" | LC_ALL=C sort
- if test "${BUILD_MINGW}" = "yes"; then
sudo apt-get -qq update &&
sudo apt-get -qq install wine;
fi
script:
- if test "${BUILD_MINGW}" != "yes"; then
make &&
make test &&
make release;
else
export CC=i586-mingw32msvc-gcc;
echo -e '#!/bin/bash\nexec wine $0.exe "$@"' > unifdef;
chmod ugo+x unifdef;
make version.h &&
make -f win32/Makefile.mingw test;
fi
branches:
only:
- master
- next
- /^travis.*/
- /^tmp.*/

85
contrib/unifdef/COPYING Normal file
View file

@ -0,0 +1,85 @@
unifdef copyright licence
-------------------------
All files in this package are distributed under the two-clause BSD
copyright licence, except for the manual page unifdef.1 and the
portability support code in the FreeBSD subdirectory, which all have
a three-clause BSD copyright licence.
Unifdef was derived from software contributed to Berkeley by Dave
Yost. It was rewritten to support ANSI C by Tony Finch. The original
version of unifdef.c carried the four-clause BSD copyright licence.
None of its code remains in this version (though some of the names
remain) so it now carries the more liberal two-clause licence.
Unless otherwise stated, the files in this package are:
Copyright (c) 2002 - 2020 Tony Finch <dot@dotat.at>
unifdefall.sh is:
Copyright (c) 2002 - 2013 Tony Finch <dot@dotat.at>
Copyright (c) 2009 - 2010 Jonathan Nieder <jrnieder@gmail.com>
Some files in the tests directory are:
Copyright 2004, 2008 Bob Proulx <bob@proulx.com>
The two-clause BSD copyright licence applying to all the above files is:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
The three-clause BSD copyright licence for the manual page unifdef.1
and the portability support code from FreeBSD is below. The fourth
advertising clause that used to appear between clauses 2 and 3 was
rescinded by the University of California Berkeley in 1999.
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
Copyright (c) 1985 - 1994
The Regents of the University of California. All rights reserved.
Copyright (c) 2002 - 2012 Tony Finch <dot@dotat.at>. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. 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.
3. Neither the name of the University 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 REGENTS 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.
- end -

View file

@ -0,0 +1,138 @@
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 4. Neither the name of the University 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 REGENTS 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.
*/
#include "unifdef.h"
void
err(int eval, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verrc(eval, errno, fmt, ap);
va_end(ap);
}
void
verr(int eval, const char *fmt, va_list ap)
{
verrc(eval, errno, fmt, ap);
}
void
errc(int eval, int code, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verrc(eval, code, fmt, ap);
va_end(ap);
}
void
verrc(int eval, int code, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", _getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(code));
exit(eval);
}
void
errx(int eval, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
verrx(eval, fmt, ap);
va_end(ap);
}
void
verrx(int eval, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", _getprogname());
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
exit(eval);
}
void
warn(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarnc(errno, fmt, ap);
va_end(ap);
}
void
vwarn(const char *fmt, va_list ap)
{
vwarnc(errno, fmt, ap);
}
void
warnc(int code, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarnc(code, fmt, ap);
va_end(ap);
}
void
vwarnc(int code, const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", _getprogname());
if (fmt != NULL) {
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": ");
}
fprintf(stderr, "%s\n", strerror(code));
}
void
warnx(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vwarnx(fmt, ap);
va_end(ap);
}
void
vwarnx(const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", _getprogname());
if (fmt != NULL)
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
}

View file

@ -0,0 +1,118 @@
/*
* Copyright (c) 1987, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 4. Neither the name of the University 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 REGENTS 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.
*/
#include "unifdef.h"
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
static char EMSG[] = "";
/*
* getopt --
* Parse argc/argv argument vector.
*/
int
getopt(int nargc, char *nargv[], const char *ostr)
{
static char *place = EMSG; /* option letter processing */
const char *oli; /* option letter list index */
if (optreset || *place == 0) { /* update scanning pointer */
optreset = 0;
place = nargv[optind];
if (optind >= nargc || *place++ != '-') {
/* Argument is absent or is not an option */
place = EMSG;
return (-1);
}
optopt = *place++;
if (optopt == '-' && *place == 0) {
/* "--" => end of options */
++optind;
place = EMSG;
return (-1);
}
if (optopt == 0) {
/* Solitary '-', treat as a '-' option
if the program (eg su) is looking for it. */
place = EMSG;
if (strchr(ostr, '-') == NULL)
return (-1);
optopt = '-';
}
} else
optopt = *place++;
/* See if option letter is one the caller wanted... */
if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) {
if (*place == 0)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", _getprogname(),
optopt);
return (BADCH);
}
/* Does this option need an argument? */
if (oli[1] != ':') {
/* don't need argument */
optarg = NULL;
if (*place == 0)
++optind;
} else {
/* Option-argument is either the rest of this argument or the
entire next argument. */
if (*place)
optarg = place;
else if (nargc > ++optind)
optarg = nargv[optind];
else {
/* option-argument absent */
place = EMSG;
if (*ostr == ':')
return (BADARG);
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
_getprogname(), optopt);
return (BADCH);
}
place = EMSG;
++optind;
}
return (optopt); /* return option letter */
}

36
contrib/unifdef/INSTALL Normal file
View file

@ -0,0 +1,36 @@
unifdef installation instructions
---------------------------------
Dependencies:
* unifdef is mostly ANSI C, with a few unixisms
* unifdefall is a Unix shell script
* the manual uses the nroff mdoc macros
* the support and test scripts are Unix shell scripts
To build on Unix, type `make`. You can adjust the compilation options
using the POSIX standard CFLAGS and LDFLAGS make variables.
To install in your home directory, type `make install`
or to install in /usr type `make prefix=/usr install`.
See the start of the Makefile for the install location
variables.
The win32 subdirectory contains build files for MinGW and Visual
Studio 2010 which make use of the FreeBSD code plus some other
portability wrappers.
To build with MinGW, type `mingw32-make -f win32/Makefile.mingw`.
Unlike the Unix Makefile, the Windows builds do not automatically
create or update version.h. The release tar and zip files include a
pre-generated version.h but the git repository does not. To build from
a git clone you need a Unix shell environment, which you can get as
part of GitHub for Windows - http://windows.github.com/
To update version.h, right-click on the fanf2/unifdef repository and
select "open a shell here", then type `sh scripts\reversion.sh`.
We assume Unix provides the BSD err.h functions and C99 stdbool.h. The
FreeBSD subdirectory has copies of err.c and getopt.c for systems such
as Windows that don't have them built in.
- end -

58
contrib/unifdef/Makefile Normal file
View file

@ -0,0 +1,58 @@
# Makefile for unifdef
prefix = ${HOME}
bindir = ${prefix}/bin
mandir = ${prefix}/share/man
man1dir= ${mandir}/man1
bindest= ${DESTDIR}${bindir}
man1dest= ${DESTDIR}${man1dir}
all: unifdef
unifdef: unifdef.c unifdef.h version.h
${CC} ${CFLAGS} ${LDFLAGS} -o unifdef unifdef.c
version.h: version.sh
version.sh::
scripts/reversion.sh
test: unifdef
scripts/runtests.sh tests
install: unifdef unifdefall.sh unifdef.1
: commands
install -m 755 -d ${bindest}
install -m 755 unifdef ${bindest}/
install -m 755 unifdefall.sh ${bindest}/unifdefall
: manual
install -m 755 -d ${man1dest}
install -m 644 unifdef.1 ${man1dest}/
ln -s unifdef.1 ${man1dest}/unifdefall.1
clean:
rm -f unifdef version.h
rm -f tests/*.out tests/*.err tests/*.rc
realclean: clean
rm -f unifdef.txt
[ ! -d .git ] || rm -f Changelog version.sh
find . -name .git -prune -o \( \
-name '*~' -o -name '.#*' -o \
-name '*.orig' -o -name '*.core' -o \
-name 'xterm-*' -o -name 'xterm.tar.gz' \
\) -delete
DISTEXTRA= version.h version.sh unifdef.txt Changelog
release: ${DISTEXTRA}
scripts/copycheck.sh
scripts/release.sh ${DISTEXTRA}
unifdef.txt: unifdef.1
nroff -Tascii -mdoc unifdef.1 | col -bx >unifdef.txt
Changelog: version.sh scripts/gitlog2changelog.sh
scripts/gitlog2changelog.sh >Changelog
# eof

53
contrib/unifdef/README Normal file
View file

@ -0,0 +1,53 @@
unifdef - selectively remove C preprocessor conditionals
Written by Tony Finch <dot@dotat.at> - http://dotat.at/prog/unifdef/
The unifdef utility selectively processes conditional C preprocessor
#if and #ifdef directives. It removes from a file both the directives
and the additional text that they delimit, while otherwise leaving the
file alone.
Please see the INSTALL file for installation instructions.
Pre-formatted documentation can be found in unifdef.txt
You can download the latest release tar and zip files from:
http://dotat.at/prog/unifdef
You can clone the development repository using:
git clone http://dotat.at/git/unifdef.git
I also maintain a copy at http://github.com/fanf2/unifdef
(Warning: GitHub's zip download is incomplete and unusable.)
Please send bug reports and patches to me via email to the
address above. Unless you state otherwise, I will assume that
any contributions are under the two-clause BSD licence. See
the COPYING file for details.
Thanks to the following people for their contributions:
Bob Proulx <bob@proulx.com>
- test suite
Jonathan Nieder <jrnieder@gmail.com>
- bug fixes, improved unifdefall
Anders H Kaseorg <andersk@mit.edu>
- bug fixes and other improvements
Ruediger Meier <ruediger.meier@ga-group.nl>
- build and portability cleanups
Ben Hutchings at Solarflare Communications
- lenient evaluation of && and ||
Steve Underwood <steveu@coppice.org>
- read #define and #undef directives from a file
Brian Ginsbach <ginsbach@netbsd.org>
- improved expression evaluator
Other contributions are listed in the Changelog.
- end -

42
contrib/unifdef/ifdef-how.pl Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/perl
use warnings;
use strict;
if (@ARGV != 2) {
die <<END;
usage: ifdef-how <file> <line>
Print the sequence of preprocessor conditionals which lead to the
given line being retained after preprocessing. There is no output
if the line is always retained. Conditionals that must be true are
printed verbatim; conditionals that musy be false have their
preprocessor keyword prefixed with NOT.
Warning: this program does not parse comments or strings, so it will
not handle tricky code correctly.
END
}
my $file = shift;
my $line = shift;
open my $fh, '<', $file
or die "ifdef-how: open $file: $!\n";
my @stack;
while (<$fh>) {
last if $. == $line;
if (m{^\s*#\s*(if|ifdef|ifndef)\b}) {
push @stack, $_;
}
if (m{^\s*#\s*(elif|else)\b}) {
$stack[-1] =~ s{^(\s*#\s*)(?!NOT)\b}{${1}NOT}gm;
$stack[-1] .= $_;
}
if (m{^\s*#\s*endif\b}) {
pop @stack;
}
}
print @stack;

View file

@ -0,0 +1,15 @@
charnier = Philippe Charnier <charnier@FreeBSD.org>
dd = Dima Dorfman <dd@FreeBSD.org>
ed = Ed Schouten <ed@FreeBSD.org>
fanf = Tony Finch <fanf@FreeBSD.org>
hrs = Hiroki Sato <hrs@FreeBSD.org>
imp = Warner Losh <imp@FreeBSD.org>
jmallett = Juli Mallett <jmallett@FreeBSD.org>
joel = Joel Dahl <joel@FreeBSD.org>
markm = Mark Murray <markm@FreeBSD.org>
nik = Nik Clayton <nik@FreeBSD.org>
obrien = David E. O'Brien <obrien@FreeBSD.org>
peter = Peter Wemm <peter@FreeBSD.org>
rgrimes = Rodney W. Grimes <rgrimes@FreeBSD.org>
ru = Ruslan Ermilov <ru@FreeBSD.org>
schweikh = Jens Schweikhardt <schweikh@FreeBSD.org>

View file

@ -0,0 +1,21 @@
#!/bin/sh
me=$(git config user.name || echo WHO-AM-I)
now=$(date +%Y)
! git grep -l "Copyright .* $me" |
grep -v 'tests/.*[.]exp[a-z]*' |
( while read f
do git log --format="%ci $f" -1 -- $f
done;
git log --format="%ci COPYING" -1
) |
grep ^$now |
while read d t z f
do grep -H -m 1 "Copyright .* $me" $f
done |
grep -v $now
grep ^[.]Dd unifdef.1 | grep -v "$(date +'%B [0-9]*, %Y')"
exit 0

View file

@ -0,0 +1,9 @@
#!/bin/sh
for ext in err out rc
do
for f in tests/*.$ext
do
mv $f ${f%.$ext}.exp$ext
done
done

View file

@ -0,0 +1,10 @@
[core]
repositoryformatversion = 0
[svn-remote "svn"]
rewriteRoot = svn://svn.FreeBSD.org/base/head/usr.bin/unifdef
url = svn+ssh://fanf@svn.FreeBSD.org/base/head/usr.bin/unifdef
fetch = :refs/remotes/git-svn
[remote "github"]
url = git@github.com:fanf2/unifdef.git
fetch = +refs/heads/*:refs/remotes/github/*
fetch = +refs/pull/*/head:refs/remotes/github/pull/*

View file

@ -0,0 +1,9 @@
#!/bin/sh
line="---------------------------------------------------"
git log --no-merges -M --stat \
--pretty=format:"$line%n%ai %an <%ae>%n%n%s%n%n%b" |
uniq | fold -s
echo
echo $line

View file

@ -0,0 +1,18 @@
#!/bin/sh
. ./version.sh
for f in $@ $(git ls-files | egrep -v '^web/|^[.]git$')
do
mkdir -p web/$V/$(dirname $f)
cp $f web/$V/$f
done
cd web
zip -qr $V.zip $V
tar cf $V.tar $V
xz -k9 $V.tar
gzip -9 $V.tar
rm -R $V
ls -l $V.*

View file

@ -0,0 +1,41 @@
#!/bin/sh
if [ ! -f version.sh ] && [ ! -d .git ]
then
echo Your copy of unifdef is incomplete 1>&2
exit 1
fi
[ -f version.sh ] && . ./version.sh
if [ -d .git ]
then
GV=$(git describe | sed 's|-g*|.|g;s|[.]|-|')
git update-index -q --refresh
if git diff-index --quiet HEAD
then
GD="$(git show --pretty=format:%ai -s HEAD)"
else
GD="$(date +'%Y-%m-%d %H:%M:%S %z')"
GV=$GV.XX
fi
[ unifdef -nt unifdef.c ] &&
[ unifdef -nt unifdef.h ] &&
GD="$D"
if [ "$GV $GD" != "$V $D" ]
then
echo "version $V $D" 1>&2
echo " -> $GV $GD" 1>&2
V="$GV"
D="$GD"
echo "V=\"$V\"" >version.sh
echo "D=\"$D\"" >>version.sh
rm -f version.h
fi
fi
if [ ! -f version.h ]
then
printf '"@(#) $Version: %s $\\n"\n' "$V" >version.h
printf '"@(#) $Date: %s $\\n"\n' "$D" >>version.h
fi

View file

@ -0,0 +1,38 @@
#!/bin/sh
export PATH="$(pwd):${PATH}"
${1:+cd} ${1:-:}
for cmd in *.sh
do
printf .
t=${cmd%.sh}
sh ./${cmd} >${t}.out 2>${t}.err
echo $? >${t}.rc
# strip carriage returns from error output
# in case we are trying to run on MinGW
tr -d ' ' >${t}.xerr <${t}.err
mv ${t}.xerr ${t}.err
ok=true
for e in out err rc
do
exp=${t}.exp${e}
got=${t}.${e}
if ! cmp -s ${exp} ${got}
then
echo
echo FAILED: ${got}: $(cat ${cmd})
diff -u ${exp} ${got}
ok=false
fi
done
if ${ok}
then rm -f ${t}.out ${t}.err ${t}.rc
else rc=1
fi
done
echo
exit ${rc}

View file

@ -0,0 +1,12 @@
#!/bin/sh -e
git svn fetch -A scripts/authors.svn
git checkout FreeBSD
case "$(git merge --no-commit git-svn)" in
"Already up-to-date.")
exit 0
esac
git commit -m 'Merge back from svn'

View file

@ -0,0 +1,19 @@
#!/bin/sh -e
make unifdef.txt
cp unifdef.txt web
git gc --aggressive
git update-server-info
git push --all github
git push --tags github
# for gitweb
echo "selectively remove C preprocessor conditionals" >.git/description
echo "Homepage: <a href='http://dotat.at/prog/unifdef'>http://dotat.at/prog/unifdef</a>" >.git/README.html
touch .git/git-daemon-export-ok
rsync --recursive --links --delete .git/ chiark:public-git/unifdef.git/
rsync --recursive --links web/ chiark:public-html/prog/unifdef/
exit

View file

View file

View file

@ -0,0 +1 @@
0

View file

@ -0,0 +1 @@
unifdef </dev/null >/dev/null 2>&1 || true

View file

@ -0,0 +1,25 @@
#if defined(__FreeBSD__)
#include <netinet/if_fddi.h>
#else
#include <net/if_fddi.h>
#endif
#if defined(__FreeBSD__)
#include <stdbool.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdbool.h>
#else
#include <stdint.h>
#endif
#if defined(__FreeBSD__)
#endif
#ifdef __FreeBSD__
#include <unistd.h>
#else
#include <inttypes.h>
#endif

View file

@ -0,0 +1,6 @@
#include <net/if_fddi.h>
#include <stdint.h>
#include <inttypes.h>

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -U__FreeBSD__ NetBSD-42628.c

View file

@ -0,0 +1,2 @@
#ifdef foo
#endif

View file

@ -0,0 +1,2 @@
#ifdef foo
#endif

View file

@ -0,0 +1 @@
0

View file

@ -0,0 +1 @@
unifdef -Ubar NetBSD-47068.c

View file

@ -0,0 +1,3 @@
#if defined(DUMMY) || FOO(arg)
hello
#endif

View file

View file

@ -0,0 +1 @@
hello

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -DFOO=1 -DFOOB=42 -UBAR args1.c

View file

@ -0,0 +1,3 @@
#if defined(FOO) || BAR(arg)
hello
#endif

View file

View file

@ -0,0 +1,3 @@
#if defined(FOO) || BAR(arg)
hello
#endif

View file

@ -0,0 +1 @@
0

View file

@ -0,0 +1 @@
unifdef -DFOO=1 -DFOOB=42 -UBAR args2.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,23 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
zero

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -DFOO0 blank0d.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,22 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -UFOO0 blank0u.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,23 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
one
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -DFOO1 blank1d.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,21 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -UFOO1 blank1u.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,23 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
two
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -DFOO2 blank2d.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,20 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -UFOO2 blank2u.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,23 @@
#ifdef FOO4
four
#endif
three
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -DFOO3 blank3d.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,19 @@
#ifdef FOO4
four
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -UFOO3 blank3u.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,23 @@
four
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -DFOO4 blank4d.c

View file

@ -0,0 +1,25 @@
#ifdef FOO4
four
#endif
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

View file

@ -0,0 +1,18 @@
#ifdef FOO3
three
#endif
#ifdef FOO2
two
#endif
#ifdef FOO1
one
#endif
#ifdef FOO0
zero
#endif

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -B -UFOO4 blank4u.c

View file

@ -0,0 +1 @@
#define /* nothing */

View file

@ -0,0 +1 @@
#undef &%^$&%$##@^$

View file

@ -0,0 +1,2 @@
#define FOO \
bar

View file

View file

@ -0,0 +1,10 @@
int f1() { return 0; }
\/
/\
comment
/\
*\
comment
*\
/\
eof

View file

@ -0,0 +1 @@
1

View file

@ -0,0 +1 @@
unifdef -DF1 crlf.c

Some files were not shown because too many files have changed in this diff Show more