Mercurial > mplayer.hg
annotate TOOLS/checktree.sh @ 23688:3454aed9d083
Add equivalent of -Wno-pointer-sign for icc
author | cehoyos |
---|---|
date | Mon, 02 Jul 2007 22:02:59 +0000 |
parents | 0e8285c7b2fa |
children | 91ccac9cc015 |
rev | line source |
---|---|
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
1 #!/bin/sh |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
2 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
3 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
4 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
5 # Check source-tree for anomalies |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
6 # |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
7 # (C)opyright 2005 by Ivo van Poorten |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
8 # Licensed under GNU General Public License version 2 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
9 # |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
10 # Thanks to Melchior Franz of the FlightGear project for the original idea |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
11 # of a source-tree checker and Torinthiel for the feedback along the way. |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
12 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
13 # $Id$ |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
14 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
15 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
16 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
17 # Default settings |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
18 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
19 _spaces=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
20 _extensions=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
21 _crlf=yes |
23235 | 22 _tabs=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
23 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
24 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
25 _oll=no |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
26 _charset=no |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
27 _stupid=no |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
28 _showcont=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
29 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
30 _color=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
31 _head=yes |
19077 | 32 _svn=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
33 _files= |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
34 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
35 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
36 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
37 # Avoid locale problems |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
38 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
39 export LC_ALL=C |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
40 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
41 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
42 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
43 # Helper functions |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
44 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
45 enable_all_tests() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
46 _spaces=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
47 _extensions=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
48 _crlf=yes |
23235 | 49 _tabs=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
50 _trailws=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
51 _rcsid=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
52 _oll=yes |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
53 _charset=yes |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
54 _stupid=yes |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
55 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
56 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
57 disable_all_tests() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
58 _spaces=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
59 _extensions=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
60 _crlf=no |
23235 | 61 _tabs=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
62 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
63 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
64 _oll=no |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
65 _charset=no |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
66 _stupid=no |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
67 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
68 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
69 printoption() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
70 echo " -(no)$1 $2 [default: $3]" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
71 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
72 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
73 printhead() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
74 test "$_head" = "yes" && echo -e "$COLB$1$COLE" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
75 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
76 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
77 all_filenames() { |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
78 test "$_files" != "" && echo "$_files" && return |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
79 |
20204 | 80 if [ "$_svn" = "no" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
81 find . -type f \ |
19077 | 82 | grep -v "\.\#\|\~$\|\.depend\|\/\.svn\/\|config.mak\|^\./config\.h" \ |
19078
4361813f6cae
also omit configure.log and the generated help_mp.h from files to check
ivo
parents:
19077
diff
changeset
|
83 | grep -v "^\./version\.h\|\.o$\|\.a$\|configure.log\|^\./help_mp.h" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
84 else |
22361
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
85 svn info -R | sed -n '/Path:/bb; :a; d; b; :b; s/Path: /.\//; h; :c; n; |
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
86 /Node Kind:/bd; bc; :d; /directory/ba; g; p;' |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
87 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
88 } |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
89 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
90 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
91 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
92 # Parse command line |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
93 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
94 for i in "$@"; do |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
95 case "$i" in |
22359
206b4600a956
also respond to --help, -h and -? command line options
ivo
parents:
22358
diff
changeset
|
96 -help|--help|-h|-\?) |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
97 echo -e "\n$0 [options] [files]\n" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
98 echo -e "options:\n" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
99 printoption "spaces " "test for spaces in filenames" "$_spaces" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
100 printoption "extensions" "test for uppercase extensions" "$_extensions" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
101 printoption "crlf " "test for MSDOS line endings" "$_crlf" |
23235 | 102 printoption "tabs " "test for tab characters" "$_tabs" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
103 printoption "trailws " "test for trailing whitespace" "$_trailws" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
104 printoption "rcsid " "test for missing RCS Id's" "$_rcsid" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
105 printoption "oll " "test for overly long lines" "$_oll" |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
106 printoption "charset " "test for wrong charset" "$_charset" |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
107 printoption "stupid " "test for stupid code" "$_stupid" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
108 echo |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
109 printoption "all " "enable all tests" "no" |
22357 | 110 echo " (-noall can be specified as -none)" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
111 echo |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
112 printoption "showcont " "show offending content of file(s)" \ |
19080 | 113 "$_showcont" |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
114 echo |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
115 printoption "color " "colored output" "$_color" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
116 printoption "head " "print heading for each test" "$_head" |
22509 | 117 printoption "svn " \ |
22361
eec955510da7
do not rely on svn internals and use svn info instead
ivo
parents:
22359
diff
changeset
|
118 "use svn info to determine which files to check" "$_svn" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
119 echo -e "\nIf no files are specified, the whole tree is traversed." |
19077 | 120 echo -e "If there are, -(no)svn has no effect.\n" |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
121 exit |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
122 ;; |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
123 -stupid) |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
124 _stupid=yes |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
125 ;; |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
126 -nostupid) |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
127 _stupid=no |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
128 ;; |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
129 -charset) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
130 _charset=yes |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
131 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
132 -nocharset) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
133 _charset=no |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
134 ;; |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
135 -oll) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
136 _oll=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
137 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
138 -nooll) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
139 _oll=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
140 ;; |
19077 | 141 -svn) |
142 _svn=yes | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
143 ;; |
19077 | 144 -nosvn) |
145 _svn=no | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
146 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
147 -head) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
148 _head=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
149 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
150 -nohead) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
151 _head=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
152 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
153 -color) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
154 _color=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
155 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
156 -nocolor) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
157 _color=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
158 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
159 -spaces) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
160 _spaces=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
161 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
162 -nospaces) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
163 _spaces=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
164 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
165 -extensions) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
166 _extensions=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
167 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
168 -noextensions) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
169 _extensions=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
170 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
171 -crlf) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
172 _crlf=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
173 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
174 -nocrlf) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
175 _crlf=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
176 ;; |
23235 | 177 -tabs) |
178 _tabs=yes | |
179 ;; | |
180 -notabs) | |
181 _tabs=no | |
182 ;; | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
183 -trailws) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
184 _trailws=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
185 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
186 -notrailws) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
187 _trailws=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
188 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
189 -rcsid) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
190 _rcsid=yes |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
191 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
192 -norcsid) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
193 _rcsid=no |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
194 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
195 -all) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
196 enable_all_tests |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
197 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
198 -noall) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
199 disable_all_tests |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
200 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
201 -none) |
16405 | 202 disable_all_tests |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
203 ;; |
17131
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
204 -showcont) |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
205 _showcont=yes |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
206 ;; |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
207 -noshowcont) |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
208 _showcont=no |
80d3fdcf58a8
option to show the lines containing anomalies, patch by Ivo van Poorten
wanderer
parents:
16405
diff
changeset
|
209 ;; |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
210 -*) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
211 echo "unknown option: $i" >&2 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
212 exit 0 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
213 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
214 *) |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
215 _files="$_files $i" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
216 ;; |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
217 esac |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
218 done |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
219 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
220 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
221 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
222 # Set heading color |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
223 |
20204 | 224 if [ "$_color" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
225 COLB="\e[36m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
226 COLE="\e[m" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
227 else |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
228 COLB="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
229 COLE="" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
230 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
231 |
19077 | 232 # Generate filelist once so -svn isn't _that_ much slower than -nosvn anymore |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
233 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
234 filelist=`all_filenames` |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
235 |
20204 | 236 if [ "$_showcont" = "yes" ]; then |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
237 _diffopts="-u" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
238 _grepopts="-n -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
239 else |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
240 _diffopts="-q" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
241 _grepopts="-l -I" |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
242 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
243 |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
244 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
245 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
246 # DO CHECKS |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
247 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
248 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
249 |
20204 | 250 if [ "$_spaces" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
251 printhead "checking for spaces in filenames ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
252 find . | grep " " |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
253 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
254 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
255 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
256 |
20204 | 257 if [ "$_extensions" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
258 printhead "checking for uppercase extensions ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
259 echo $filelist | grep "\.[[:upper:]]\+$" | grep -v "\.S$" |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
260 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
261 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
262 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
263 |
20204 | 264 if [ "$_crlf" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
265 printhead "checking for MSDOS line endings ..." |
19079 | 266 CR=`echo " " | tr ' ' '\015'` |
267 grep $_grepopts "$CR" $filelist | |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
268 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
269 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
270 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
271 |
23235 | 272 if [ "$_tabs" = "yes" ]; then |
273 printhead "checking for TAB characters ..." | |
274 TAB=`echo " " | tr ' ' '\011'` | |
275 grep $_grepopts "$TAB" $filelist | |
276 fi | |
277 | |
278 # ----------------------------------------------------------------------------- | |
279 | |
20204 | 280 if [ "$_trailws" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
281 printhead "checking for trailing whitespace ..." |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
282 grep $_grepopts "[[:space:]]\+$" $filelist |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
283 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
284 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
285 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
286 |
20204 | 287 if [ "$_rcsid" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
288 printhead "checking for missing RCS \$Id\$ or \$Revision\$ tags ..." |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
289 grep -L -I "\$\(Id\|Revision\)[[:print:]]\+\$" $filelist |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
290 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
291 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
292 # ----------------------------------------------------------------------------- |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
293 |
20204 | 294 if [ "$_oll" = "yes" ]; then |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
295 printhead "checking for overly long lines (over 79 characters) ..." |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
296 grep $_grepopts "^[[:print:]]\{80,\}$" $filelist |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
297 fi |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
298 |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
299 # ----------------------------------------------------------------------------- |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
300 |
20204 | 301 if [ "$_charset" = "yes" ]; then |
18087
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
302 printhead "checking bad charsets ..." |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
303 for I in $filelist ; do |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
304 case "$I" in |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
305 ./help/help_mp-*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
306 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
307 ./DOCS/*) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
308 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
309 *.c|*.h) |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
310 iconv -c -f ascii -t ascii "$I" | diff $_diffopts "$I" - |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
311 ;; |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
312 esac |
edffd6f8a022
add check for non-ascii charsets used in code and simplify showcont switch handling
reimar
parents:
17131
diff
changeset
|
313 done |
16240
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
314 fi |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
315 |
d4cf25d45b13
Script to check (CVS) source-tree for anomalies, like MSDOS line endings etc..
ivo
parents:
diff
changeset
|
316 # ----------------------------------------------------------------------------- |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
317 |
20204 | 318 if [ "$_stupid" = "yes" ]; then |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
319 printhead "checking for stupid code ..." |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
320 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
321 # avoid false-positives in xpm files, docs, etc, only check .c and .h files |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
322 chfilelist=`echo $filelist | tr ' ' '\n' | grep "[\.][ch]$"` |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
323 |
23233 | 324 if [ -n "$chfilelist" ]; then |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
325 for i in calloc malloc realloc memalign av_malloc av_mallocz faad_malloc \ |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
326 lzo_malloc safe_malloc mpeg2_malloc _ogg_malloc; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
327 printhead "--> casting of void* $i()" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
328 grep $_grepopts "([ ]*[a-zA-Z_]\+[ ]*\*.*)[ ]*$i" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
329 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
330 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
331 for i in "" signed unsigned; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
332 printhead "--> usage of sizeof($i char)" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
333 grep $_grepopts "sizeof[ ]*([ ]*$i[ ]*char[ ]*)" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
334 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
335 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
336 for i in int8_t uint8_t; do |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
337 printhead "--> usage of sizeof($i)" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
338 grep $_grepopts "sizeof[ ]*([ ]*$i[ ]*)" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
339 done |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
340 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
341 printhead "--> usage of &&1" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
342 grep $_grepopts "&&[ ]*1" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
343 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
344 printhead "--> usage of ||0" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
345 grep $_grepopts "||[ ]*0" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
346 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
347 # added a-fA-F_ to eliminate some false positives |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
348 printhead "--> usage of *0" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
349 grep $_grepopts "[a-zA-Z0-9)]\+[ ]*\*[ ]*0[^.0-9xa-fA-F_]" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
350 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
351 printhead "--> usage of *1" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
352 grep $_grepopts "[a-zA-Z0-9)]\+[ ]*\*[ ]*1[^.0-9ea-fA-F_]" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
353 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
354 printhead "--> usage of +0" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
355 grep $_grepopts "[a-zA-Z0-9)]\+[ ]*+[ ]*0[^.0-9xa-fA-F_]" $chfilelist |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
356 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
357 printhead "--> usage of -0" |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
358 grep $_grepopts "[a-zA-Z0-9)]\+[ ]*-[ ]*0[^.0-9xa-fA-F_]" $chfilelist |
23233 | 359 fi |
19085
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
360 fi |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
361 |
e5ec659ec1c6
added checks for stupid code like casting return value of malloc and friends,
ivo
parents:
19083
diff
changeset
|
362 # ----------------------------------------------------------------------------- |