diff options
author | kris <kris@FreeBSD.org> | 2000-03-25 07:45:29 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2000-03-25 07:45:29 +0000 |
commit | 533744c77137b94ed05e2ca445ba97d71c79ee5f (patch) | |
tree | fa102ad70fa8d5585900bf7e1872826b467f5d2e /contrib/gperf/tests/validate | |
parent | 6cfe3ae61b383acc12d75bc595be2ab185d5586c (diff) | |
download | FreeBSD-src-533744c77137b94ed05e2ca445ba97d71c79ee5f.zip FreeBSD-src-533744c77137b94ed05e2ca445ba97d71c79ee5f.tar.gz |
Virgin import of gperf v2.7
Diffstat (limited to 'contrib/gperf/tests/validate')
-rwxr-xr-x | contrib/gperf/tests/validate | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/contrib/gperf/tests/validate b/contrib/gperf/tests/validate new file mode 100755 index 0000000..a4813ab --- /dev/null +++ b/contrib/gperf/tests/validate @@ -0,0 +1,54 @@ +#! /bin/sh +# Validate gperf's operation on a given input file. +# Usage: validate languages input.gperf [more gperf options] +# Uses the environment variables GPERF, CC, CFLAGS, CXX, CXXFLAGS. +# Supposes gcc and g++. + +# Exit on error +set -e + +verbose () { + echo "$@" + "$@" +} + +languages=$1 +shift + +for lang in `echo $languages | sed -e 's/,/ /g'`; do + case "$lang" in + KR-C ) + echo "${GPERF} -I -L KR-C $@ > valitest.c" + ${GPERF} -I -L KR-C "$@" > valitest.c + grep -n ' const ' valitest.c /dev/null && exit 1 + verbose ${CC} ${CFLAGS} -traditional valitest.c -o valitest + ./valitest + verbose ${CC} ${CFLAGS} -ansi -pedantic valitest.c -o valitest + ./valitest + ;; + C ) + echo "${GPERF} -I -L C $@ > valitest.c" + ${GPERF} -I -L C "$@" > valitest.c + verbose ${CC} ${CFLAGS} -traditional -Dconst= valitest.c -o valitest + ./valitest + verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest + ./valitest + ;; + ANSI-C ) + echo "${GPERF} -I -L ANSI-C $@ > valitest.c" + ${GPERF} -I -L ANSI-C "$@" > valitest.c + verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest + ./valitest + verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest + ./valitest + ;; + "C++" ) + echo "${GPERF} -I -L C++ $@ > valitest.c" + ${GPERF} -I -L C++ "$@" > valitest.c + verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors -DCPLUSPLUS_TEST valitest.c -o valitest + ./valitest + ;; + esac +done + +exit 0 |