gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gdb / gdb_indent.sh
CommitLineData
f6a9480e
AC
1#!/bin/sh
2
3# Try to find a GNU indent. There could be a BSD indent in front of a
4# GNU gindent so when indent is found, keep looking.
5
6e2c7fa1
DJ
6# Make certain that the script is not running in an internationalized
7# environment.
8LANG=c ; export LANG
9LC_ALL=c ; export LC_ALL
10
f6a9480e
AC
11gindent=
12indent=
13paths=`echo $PATH | sed \
14 -e 's/::/:.:/g' \
15 -e 's/^:/.:/' \
16 -e 's/:$/:./' \
17 -e 's/:/ /g'`
18for path in $paths
19do
20 if test ! -n "${gindent}" -a -x ${path}/gindent
21 then
22 gindent=${path}/gindent
23 break
24 elif test ! -n "${indent}" -a -x ${path}/indent
25 then
26 indent=${path}/indent
27 fi
28done
29
30if test -n "${gindent}"
31then
32 indent=${gindent}
33elif test -n "${indent}"
34then
35 :
36else
37 echo "Indent not found" 1>&2
38fi
39
40
41# Check that the indent found is both GNU and a reasonable version.
42# Different indent versions give different indentation.
43
3f5a3016
AC
44m1=2
45m2=2
46m3=9
47
48version=`${indent} --version 2>/dev/null < /dev/null`
49case "${version}" in
50 *GNU* ) ;;
51 * ) echo "error: GNU indent $m1.$m2.$m3 expected" 1>&2 ; exit 1;;
f6a9480e 52esac
3f5a3016
AC
53v1=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\1/'`
54v2=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\2/'`
55v3=`echo "${version}" | sed 's/^.* \([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)$/\3/'`
56
57if test $m1 -ne $v1 -o $m2 -ne $v2 -o $m3 -gt $v3
58then
59 echo "error: Must be GNU indent version $m1.$m2.$m3 or later" 1>&2
60 exit 1
61fi
f6a9480e 62
3f5a3016
AC
63if test $m3 -ne $v3
64then
65 echo "warning: GNU indent version $m1.$m2.$m3 recommended" 1>&2
66fi
f6a9480e
AC
67
68# Check that we're in the GDB source directory
69
70case `pwd` in
71 */gdb ) ;;
8efe637d 72 */sim/* ) ;;
f6a9480e
AC
73 * ) echo "Not in GDB directory" 1>&2 ; exit 1 ;;
74esac
75
76
77# Run indent per GDB specs
78
9b02dd1b
AC
79types="\
80-T FILE \
a8245ab8
JJ
81-T bfd -T asection -T pid_t \
82-T prgregset_t -T fpregset_t -T gregset_t -T sigset_t \
530b167e
JJ
83-T td_thrhandle_t -T td_event_msg_t -T td_thr_events_t \
84-T td_notify_t -T td_thr_iter_f -T td_thrinfo_t \
b2ed1746 85-T caddr_t \
9b02dd1b 86`cat *.h | sed -n \
f6a9480e
AC
87 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_ftype\).*$/-T \1/p' \
88 -e 's/^.*[^a-z0-9_]\([a-z0-9_]*_func\).*$/-T \1/p' \
89 -e 's/^typedef.*[^a-zA-Z0-9_]\([a-zA-Z0-9_]*[a-zA-Z0-9_]\);$/-T \1/p' \
90 | sort -u`"
91
92${indent} ${types} "$@"
This page took 1.381168 seconds and 4 git commands to generate.