Import unifdef 2.11

This commit is contained in:
Dag-Erling Smørgrav 2023-08-21 19:33:26 +02:00
commit 9b3517a49d
431 changed files with 6408 additions and 0 deletions

7
.gitignore vendored Normal file
View File

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

35
.travis.yml Normal file
View File

@ -0,0 +1,35 @@
language: c
compiler:
- gcc
- clang
matrix:
include:
- compiler: i586-mingw32msvc-gcc
env: BUILD_MINGW="yes"
before_install:
- sudo apt-get -qq update
install:
- if test "${BUILD_MINGW}" = "yes"; then 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
## whitelist
branches:
only:
- master
- tmp

85
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 - 2015 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 -

138
FreeBSD/err.c Normal file
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");
}

118
FreeBSD/getopt.c Normal file
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
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
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

52
README Normal file
View File

@ -0,0 +1,52 @@
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 subscribe to release announcements at:
http://freecode.com/projects/unifdef
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. 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
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 -

15
scripts/authors.svn Normal file
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>

21
scripts/copycheck.sh Executable file
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

9
scripts/fixtests.sh Executable file
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

10
scripts/git.config Normal file
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/*

8
scripts/gitlog2changelog.sh Executable file
View File

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

18
scripts/release.sh Executable file
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.*

41
scripts/reversion.sh Executable file
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

33
scripts/runtests.sh Executable file
View File

@ -0,0 +1,33 @@
#!/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
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}

12
scripts/svnup.sh Executable file
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'

19
scripts/upload.sh Executable file
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

25
tests/NetBSD-42628.c Normal file
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

View File

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

1
tests/NetBSD-42628.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/NetBSD-42628.sh Normal file
View File

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

2
tests/NetBSD-47068.c Normal file
View File

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

View File

View File

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

1
tests/NetBSD-47068.exprc Normal file
View File

@ -0,0 +1 @@
0

1
tests/NetBSD-47068.sh Normal file
View File

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

3
tests/args1.c Normal file
View File

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

0
tests/args1.experr Normal file
View File

1
tests/args1.expout Normal file
View File

@ -0,0 +1 @@
hello

1
tests/args1.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/args1.sh Normal file
View File

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

3
tests/args2.c Normal file
View File

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

0
tests/args2.experr Normal file
View File

3
tests/args2.expout Normal file
View File

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

1
tests/args2.exprc Normal file
View File

@ -0,0 +1 @@
0

1
tests/args2.sh Normal file
View File

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

25
tests/blank0d.c Normal file
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

0
tests/blank0d.experr Normal file
View File

23
tests/blank0d.expout Normal file
View File

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

1
tests/blank0d.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank0d.sh Normal file
View File

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

25
tests/blank0u.c Normal file
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

0
tests/blank0u.experr Normal file
View File

22
tests/blank0u.expout Normal file
View File

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

1
tests/blank0u.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank0u.sh Normal file
View File

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

25
tests/blank1d.c Normal file
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

0
tests/blank1d.experr Normal file
View File

23
tests/blank1d.expout Normal file
View File

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

1
tests/blank1d.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank1d.sh Normal file
View File

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

25
tests/blank1u.c Normal file
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

0
tests/blank1u.experr Normal file
View File

21
tests/blank1u.expout Normal file
View File

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

1
tests/blank1u.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank1u.sh Normal file
View File

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

25
tests/blank2d.c Normal file
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

0
tests/blank2d.experr Normal file
View File

23
tests/blank2d.expout Normal file
View File

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

1
tests/blank2d.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank2d.sh Normal file
View File

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

25
tests/blank2u.c Normal file
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

0
tests/blank2u.experr Normal file
View File

20
tests/blank2u.expout Normal file
View File

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

1
tests/blank2u.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank2u.sh Normal file
View File

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

25
tests/blank3d.c Normal file
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

0
tests/blank3d.experr Normal file
View File

23
tests/blank3d.expout Normal file
View File

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

1
tests/blank3d.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank3d.sh Normal file
View File

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

25
tests/blank3u.c Normal file
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

0
tests/blank3u.experr Normal file
View File

19
tests/blank3u.expout Normal file
View File

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

1
tests/blank3u.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank3u.sh Normal file
View File

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

25
tests/blank4d.c Normal file
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

0
tests/blank4d.experr Normal file
View File

23
tests/blank4d.expout Normal file
View File

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

1
tests/blank4d.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank4d.sh Normal file
View File

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

25
tests/blank4u.c Normal file
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

0
tests/blank4u.experr Normal file
View File

18
tests/blank4u.expout Normal file
View File

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

1
tests/blank4u.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/blank4u.sh Normal file
View File

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

1
tests/broken2.h Normal file
View File

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

1
tests/broken3.h Normal file
View File

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

2
tests/broken4.h Normal file
View File

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

0
tests/crlf-a.experr Normal file
View File

10
tests/crlf-a.expout Normal file
View File

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

1
tests/crlf-a.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/crlf-a.sh Normal file
View File

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

0
tests/crlf-b.experr Normal file
View File

14
tests/crlf-b.expout Normal file
View File

@ -0,0 +1,14 @@
#if F1
int f1() { return 0; }
#else
int f2() { return 0; }
#endif
\/
/\
comment
/\
*\
comment
*\
/\
eof

1
tests/crlf-b.exprc Normal file
View File

@ -0,0 +1 @@
1

1
tests/crlf-b.sh Normal file
View File

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

0
tests/crlf-c.experr Normal file
View File

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