annotate contrib/check_GNU_style.sh @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #!/bin/sh
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 # Checks some of the GNU style formatting rules in a set of patches.
111
kono
parents: 68
diff changeset
4 # Copyright (C) 2010, 2012, 2016 Free Software Foundation, Inc.
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 # Contributed by Sebastian Pop <sebastian.pop@amd.com>
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 # This program is free software; you can redistribute it and/or modify
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 # it under the terms of the GNU General Public License as published by
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 # the Free Software Foundation; either version 3 of the License, or
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 # (at your option) any later version.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 # GNU General Public License for more details.
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
111
kono
parents: 68
diff changeset
18 # along with this program; if not, see the file COPYING3. If not,
kono
parents: 68
diff changeset
19 # see <http://www.gnu.org/licenses/>.
kono
parents: 68
diff changeset
20
kono
parents: 68
diff changeset
21 # Set to empty in the environment to override.
kono
parents: 68
diff changeset
22 : ${color:---color=always}
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 usage() {
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 cat <<EOF
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 check_GNU_style.sh [patch]...
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 Checks the patches for some of the GNU style formatting problems.
111
kono
parents: 68
diff changeset
29 When FILE is -, read standard input.
kono
parents: 68
diff changeset
30
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 Please note that these checks are not always accurate, and
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 complete. The reference documentation of the GNU Coding Standards
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 can be found here: http://www.gnu.org/prep/standards_toc.html
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 and there are also some additional coding conventions for GCC:
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 http://gcc.gnu.org/codingconventions.html
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 EOF
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 exit 1
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 test $# -eq 0 && usage
111
kono
parents: 68
diff changeset
42 nfiles=$#
kono
parents: 68
diff changeset
43 files="$*"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
111
kono
parents: 68
diff changeset
45 stdin=false
kono
parents: 68
diff changeset
46 stdin_tmp=""
kono
parents: 68
diff changeset
47 if [ $nfiles -eq 1 ] && [ "$files" = "-" ]; then
kono
parents: 68
diff changeset
48 stdin=true
kono
parents: 68
diff changeset
49
kono
parents: 68
diff changeset
50 # By putting stdin into a temp file, we can handle it just like any other
kono
parents: 68
diff changeset
51 # file. F.i., we can cat it twice, which we can't do with stdin.
kono
parents: 68
diff changeset
52 stdin_tmp=check_GNU_style.stdin
kono
parents: 68
diff changeset
53 cat - > $stdin_tmp
kono
parents: 68
diff changeset
54 files=$stdin_tmp
kono
parents: 68
diff changeset
55 else
kono
parents: 68
diff changeset
56 for f in $files; do
kono
parents: 68
diff changeset
57 if [ "$f" = "-" ]; then
kono
parents: 68
diff changeset
58 # Let's keep things simple. Either we read from stdin, or we read
kono
parents: 68
diff changeset
59 # from files specified on the command line, not both.
kono
parents: 68
diff changeset
60 usage
kono
parents: 68
diff changeset
61 fi
kono
parents: 68
diff changeset
62 if [ ! -f "$f" ]; then
kono
parents: 68
diff changeset
63 echo "error: could not read file: $f"
kono
parents: 68
diff changeset
64 exit 1
kono
parents: 68
diff changeset
65 fi
kono
parents: 68
diff changeset
66 done
kono
parents: 68
diff changeset
67 fi
kono
parents: 68
diff changeset
68
kono
parents: 68
diff changeset
69 inp=check_GNU_style.inp
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 tmp=check_GNU_style.tmp
111
kono
parents: 68
diff changeset
71 tmp2=check_GNU_style.2.tmp
kono
parents: 68
diff changeset
72 tmp3=check_GNU_style.3.tmp
kono
parents: 68
diff changeset
73
kono
parents: 68
diff changeset
74 # Remove $tmp on exit and various signals.
kono
parents: 68
diff changeset
75 trap "rm -f $inp $tmp $tmp2 $tmp3 $stdin_tmp" 0
kono
parents: 68
diff changeset
76 trap "rm -f $inp $tmp $tmp2 $tmp3 $stdin_tmp; exit 1" 1 2 3 5 9 13 15
kono
parents: 68
diff changeset
77
kono
parents: 68
diff changeset
78 if [ $nfiles -eq 1 ]; then
kono
parents: 68
diff changeset
79 # There's no need for the file prefix if we're dealing only with one file.
kono
parents: 68
diff changeset
80 format="-n"
kono
parents: 68
diff changeset
81 else
kono
parents: 68
diff changeset
82 format="-nH"
kono
parents: 68
diff changeset
83 fi
kono
parents: 68
diff changeset
84
kono
parents: 68
diff changeset
85 # Remove the testsuite part of the diff. We don't care about GNU style
kono
parents: 68
diff changeset
86 # in testcases and the dg-* directives give too many false positives.
kono
parents: 68
diff changeset
87 remove_testsuite ()
kono
parents: 68
diff changeset
88 {
kono
parents: 68
diff changeset
89 awk 'BEGIN{testsuite=0} /^(.*:)?([1-9][0-9]*:)?\+\+\+ / && ! /testsuite\//{testsuite=0} \
kono
parents: 68
diff changeset
90 {if (!testsuite) print} /^(.*:)?([1-9][0-9]*:)?\+\+\+ (.*\/)?testsuite\//{testsuite=1}'
kono
parents: 68
diff changeset
91 }
kono
parents: 68
diff changeset
92
kono
parents: 68
diff changeset
93 grep $format '^+' $files \
kono
parents: 68
diff changeset
94 | remove_testsuite \
kono
parents: 68
diff changeset
95 | grep -v ':+++' \
kono
parents: 68
diff changeset
96 > $inp
kono
parents: 68
diff changeset
97
kono
parents: 68
diff changeset
98 cat_with_prefix ()
kono
parents: 68
diff changeset
99 {
kono
parents: 68
diff changeset
100 local f="$1"
kono
parents: 68
diff changeset
101
kono
parents: 68
diff changeset
102 if [ "$prefix" = "" ]; then
kono
parents: 68
diff changeset
103 cat "$f"
kono
parents: 68
diff changeset
104 else
kono
parents: 68
diff changeset
105 awk "{printf \"%s%s\n\", \"$prefix\", \$0}" $f
kono
parents: 68
diff changeset
106 fi
kono
parents: 68
diff changeset
107 }
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 # Grep
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 g (){
111
kono
parents: 68
diff changeset
111 local msg="$1"
kono
parents: 68
diff changeset
112 local arg="$2"
kono
parents: 68
diff changeset
113
kono
parents: 68
diff changeset
114 local found=false
kono
parents: 68
diff changeset
115 cat $inp \
kono
parents: 68
diff changeset
116 | egrep $color -- "$arg" \
kono
parents: 68
diff changeset
117 > "$tmp" && found=true
kono
parents: 68
diff changeset
118
kono
parents: 68
diff changeset
119 if $found; then
kono
parents: 68
diff changeset
120 printf "\n$msg\n"
kono
parents: 68
diff changeset
121 cat "$tmp"
kono
parents: 68
diff changeset
122 fi
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 # And Grep
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 ag (){
111
kono
parents: 68
diff changeset
127 local msg="$1"
kono
parents: 68
diff changeset
128 local arg1="$2"
kono
parents: 68
diff changeset
129 local arg2="$3"
kono
parents: 68
diff changeset
130
kono
parents: 68
diff changeset
131 local found=false
kono
parents: 68
diff changeset
132 cat $inp \
kono
parents: 68
diff changeset
133 | egrep $color -- "$arg1" \
kono
parents: 68
diff changeset
134 | egrep $color -- "$arg2" \
kono
parents: 68
diff changeset
135 > "$tmp" && found=true
kono
parents: 68
diff changeset
136
kono
parents: 68
diff changeset
137 if $found; then
kono
parents: 68
diff changeset
138 printf "\n$msg\n"
kono
parents: 68
diff changeset
139 cat "$tmp"
kono
parents: 68
diff changeset
140 fi
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 # reVerse Grep
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 vg (){
111
kono
parents: 68
diff changeset
145 local msg="$1"
kono
parents: 68
diff changeset
146 local varg="$2"
kono
parents: 68
diff changeset
147 local arg="$3"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
111
kono
parents: 68
diff changeset
149 local found=false
kono
parents: 68
diff changeset
150 cat $inp \
kono
parents: 68
diff changeset
151 | egrep -v -- "$varg" \
kono
parents: 68
diff changeset
152 | egrep $color -- "$arg" \
kono
parents: 68
diff changeset
153 > "$tmp" && found=true
kono
parents: 68
diff changeset
154
kono
parents: 68
diff changeset
155 if $found; then
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 printf "\n$msg\n"
111
kono
parents: 68
diff changeset
157 cat "$tmp"
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 fi
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 }
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
160
111
kono
parents: 68
diff changeset
161 col (){
kono
parents: 68
diff changeset
162 local msg="$1"
kono
parents: 68
diff changeset
163
kono
parents: 68
diff changeset
164 local first=true
kono
parents: 68
diff changeset
165 local f
kono
parents: 68
diff changeset
166 for f in $files; do
kono
parents: 68
diff changeset
167 prefix=""
kono
parents: 68
diff changeset
168 if [ $nfiles -ne 1 ]; then
kono
parents: 68
diff changeset
169 prefix="$f:"
kono
parents: 68
diff changeset
170 fi
kono
parents: 68
diff changeset
171
kono
parents: 68
diff changeset
172 # Don't reuse $inp, which may be generated using -H and thus contain a
kono
parents: 68
diff changeset
173 # file prefix. Re-remove the testsuite since we're not using $inp.
kono
parents: 68
diff changeset
174 cat $f | remove_testsuite \
kono
parents: 68
diff changeset
175 | grep -n '^+' \
kono
parents: 68
diff changeset
176 | grep -v ':+++' \
kono
parents: 68
diff changeset
177 > $tmp
kono
parents: 68
diff changeset
178
kono
parents: 68
diff changeset
179 # Keep only line number prefix and patch modifier '+'.
kono
parents: 68
diff changeset
180 cat "$tmp" \
kono
parents: 68
diff changeset
181 | sed 's/\(^[0-9][0-9]*:+\).*/\1/' \
kono
parents: 68
diff changeset
182 > "$tmp2"
kono
parents: 68
diff changeset
183
kono
parents: 68
diff changeset
184 # Remove line number prefix and patch modifier '+'.
kono
parents: 68
diff changeset
185 # Expand tabs to spaces according to tab positions.
kono
parents: 68
diff changeset
186 # Keep long lines, make short lines empty. Print the part past 80 chars
kono
parents: 68
diff changeset
187 # in red.
kono
parents: 68
diff changeset
188 cat "$tmp" \
kono
parents: 68
diff changeset
189 | sed 's/^[0-9]*:+//' \
kono
parents: 68
diff changeset
190 | expand \
kono
parents: 68
diff changeset
191 | awk '{ \
kono
parents: 68
diff changeset
192 if (length($0) > 80) \
kono
parents: 68
diff changeset
193 printf "%s\033[1;31m%s\033[0m\n", \
kono
parents: 68
diff changeset
194 substr($0,1,80), \
kono
parents: 68
diff changeset
195 substr($0,81); \
kono
parents: 68
diff changeset
196 else \
kono
parents: 68
diff changeset
197 print "" \
kono
parents: 68
diff changeset
198 }' \
kono
parents: 68
diff changeset
199 > "$tmp3"
kono
parents: 68
diff changeset
200
kono
parents: 68
diff changeset
201 # Combine prefix back with long lines.
kono
parents: 68
diff changeset
202 # Filter out empty lines.
kono
parents: 68
diff changeset
203 local found=false
kono
parents: 68
diff changeset
204 paste -d '\0' "$tmp2" "$tmp3" \
kono
parents: 68
diff changeset
205 | grep -v '^[0-9][0-9]*:+$' \
kono
parents: 68
diff changeset
206 > "$tmp" && found=true
kono
parents: 68
diff changeset
207
kono
parents: 68
diff changeset
208 if $found; then
kono
parents: 68
diff changeset
209 if $first; then
kono
parents: 68
diff changeset
210 printf "\n$msg\n"
kono
parents: 68
diff changeset
211 first=false
kono
parents: 68
diff changeset
212 fi
kono
parents: 68
diff changeset
213 cat_with_prefix "$tmp"
kono
parents: 68
diff changeset
214 fi
kono
parents: 68
diff changeset
215 done
kono
parents: 68
diff changeset
216 }
kono
parents: 68
diff changeset
217
kono
parents: 68
diff changeset
218
kono
parents: 68
diff changeset
219 col 'Lines should not exceed 80 characters.'
kono
parents: 68
diff changeset
220
kono
parents: 68
diff changeset
221 g 'Blocks of 8 spaces should be replaced with tabs.' \
kono
parents: 68
diff changeset
222 ' {8}'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
223
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 g 'Trailing whitespace.' \
111
kono
parents: 68
diff changeset
225 '[[:space:]]$'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
226
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
227 g 'Space before dot.' \
111
kono
parents: 68
diff changeset
228 '[[:alnum:]][[:blank:]]+\.'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
229
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
230 g 'Dot, space, space, new sentence.' \
111
kono
parents: 68
diff changeset
231 '[[:alnum:]]\.([[:blank:]]|[[:blank:]]{3,})[A-Z0-9]'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 g 'Dot, space, space, end of comment.' \
111
kono
parents: 68
diff changeset
234 '[[:alnum:]]\.([[:blank:]]{0,1}|[[:blank:]]{3,})\*/'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 g 'Sentences should end with a dot. Dot, space, space, end of the comment.' \
111
kono
parents: 68
diff changeset
237 '[[:alnum:]][[:blank:]]*\*/'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
111
kono
parents: 68
diff changeset
239 vg 'There should be exactly one space between function name and parenthesis.' \
kono
parents: 68
diff changeset
240 '\#define' \
kono
parents: 68
diff changeset
241 '[[:alnum:]]([[:blank:]]{2,})?\('
kono
parents: 68
diff changeset
242
kono
parents: 68
diff changeset
243 g 'There should be no space before a left square bracket.' \
kono
parents: 68
diff changeset
244 '[[:alnum:]][[:blank:]]+\['
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
111
kono
parents: 68
diff changeset
246 g 'There should be no space before closing parenthesis.' \
kono
parents: 68
diff changeset
247 '[[:graph:]][[:blank:]]+\)'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248
111
kono
parents: 68
diff changeset
249 # This will give false positives for C99 compound literals.
kono
parents: 68
diff changeset
250 g 'Braces should be on a separate line.' \
kono
parents: 68
diff changeset
251 '(\)|else)[[:blank:]]*{'
68
561a7518be6b update gcc-4.6
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
111
kono
parents: 68
diff changeset
253 # Does this apply to definitions of aggregate objects?
kono
parents: 68
diff changeset
254 ag 'Trailing operator.' \
kono
parents: 68
diff changeset
255 '^[1-9][0-9]*:\+[[:space:]]' \
kono
parents: 68
diff changeset
256 '(([^a-zA-Z_]\*)|([-%<=&|^?])|([^*]/)|([^:][+]))$'