File: validate

package info (click to toggle)
gperf 3.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,924 kB
  • sloc: exp: 6,462; cpp: 5,795; perl: 2,118; sh: 1,007; ansic: 875; makefile: 669
file content (61 lines) | stat: -rwxr-xr-x 1,869 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /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

# On old systems, it's worth trying gcc -traditional.
# On glibc-2.1 systems, gcc -traditional doesn't work any more.
use_traditional=false

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
      if test $use_traditional = true; then
        verbose ${CC} ${CFLAGS} ${CPPFLAGS} -traditional valitest.c -o valitest
        ./valitest
      fi
      verbose ${CC} ${CFLAGS} ${CPPFLAGS} -ansi -pedantic valitest.c -o valitest
      ./valitest
      ;;
    C )
      echo "${GPERF} -I -L C $@ > valitest.c"
      ${GPERF} -I -L C "$@" > valitest.c
      if test $use_traditional = true; then
        verbose ${CC} ${CFLAGS} ${CPPFLAGS} -traditional -Dconst= valitest.c -o valitest
        ./valitest
      fi
      verbose ${CC} ${CFLAGS} ${CPPFLAGS} -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} ${CPPFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest
      ./valitest
      verbose ${CXX} ${CXXFLAGS} ${CPPFLAGS} -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} ${CPPFLAGS} -ansi -pedantic -pedantic-errors -DCPLUSPLUS_TEST valitest.c -o valitest
      ./valitest
      ;;
  esac
done

exit 0