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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/bin/sh -
#
# $Id: chk.flags,v 12.2 2007/04/20 14:46:30 bostic Exp $
#
# Check flag name-spaces.
d=../..
t1=__1
t2=__2
if cc -g -Wall -I.. t.c -o t; then
:
else
echo "FAIL: unable to compile test program t.c"
exit 1
fi
if ./t $d/*/*.[ch] $d/*/*.in > $t1; then
:
else
echo "FAIL: test program failed"
exit 1
fi
echo Checking DB_ENV flags...
cat $t1 |
grep '(dbenv,' |
sed -e '/DB_ENV_/d' \
-e '/env_method.c.*, mapped_flags*)/d' \
-e '/env_region.c.*, flags_orig*)/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
grep 'DB_ENV_' $t1 |
sed -e '/((*dbenv)*,/d' \
-e '/((*dbp)*->dbenv,/d' \
-e '/((*env)*,/d' \
-e '/((*infop)*->dbenv,/d' \
-e '/((*reginfop)*->dbenv,/d' \
-e '/((*sdbp)*->dbenv,/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
echo Checking DB flags...
cp $t1 /tmp/_f
cat $t1 |
grep '(dbp,' |
sed -e '/DB_AM_/d' \
-e '/dbp, mapped_flag)/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
grep 'DB_AM_' $t1 |
sed \
-e '/(&db,/d' \
-e '/((*[ ]*db_rep->rep_db)*,/d' \
-e '/((*[ ]*dbc)*->dbp,/d' \
-e '/((*[ ]*dbc_arg->dbp)*,/d' \
-e '/((*[ ]*dbp)*,/d' \
-e '/((*[ ]*dbp)*->s_primary,/d' \
-e '/((D),/d' \
-e '/((sdbp),/d' \
-e '/(file_dbp,/d' \
-e '/(ldbp,/d' \
-e '/(mdbp,/d' \
-e '/(pdbp,/d' \
-e '/(pginfo, /d' \
-e '/(sdbp,/d' \
-e '/(subdbp,/d' \
-e '/fop_util.c:.*(t2dbp,/d' \
-e '/fop_util.c:.*(tmpdbp,/d' \
-e '/rep_backup.c.*(rfp,/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
echo Checking DBC flags...
cat $t1 |
grep '(dbc,' |
sed -e '/DBC_/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
grep 'DBC_' $t1 |
sed -e '/((*dbc)*,/d' \
-e '/(dbc_arg,/d' \
-e '/(dbc_c,/d' \
-e '/(dbc_n,/d' \
-e '/(dbc_orig,/d' \
-e '/(opd,/d' \
-e '/(pdbc,/d' \
-e '/(sdbc,/d' \
> $t2
[ -s $t2 ] && {
cat $t2
exit 1
}
echo Checking for bad use of macros...
egrep 'case .*F_SET\(|case .*F_CLR\(' $d/*/*.c > $t1
egrep 'for .*F_SET\(|for .*F_CLR\(' $d/*/*.c >> $t1
egrep 'if .*F_SET\(|if .*F_CLR\(' $d/*/*.c >> $t1
egrep 'switch .*F_SET\(|switch .*F_CLR\(' $d/*/*.c >> $t1
egrep 'while .*F_SET\(|while .*F_CLR\(' $d/*/*.c >> $t1
[ -s $t1 ] && {
echo 'if statement followed by non-test macro'
cat $t1
exit 1
}
exit 0
|