blob: f58e213c9d4b8735aacdd92bed87b9a22754cc80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
# This script attempts to find bad ifdef's, i.e. ifdef's that use braces
# but not the do { ... } while (0) syntax
#
# $PostgreSQL: pgsql/src/tools/find_badmacros,v 1.2 2006/03/11 04:38:41 momjian Exp $
#
# This is useful for running before pgindent
for FILE
do
awk ' BEGIN {was_define = "N"}
{ if (was_define == "Y" &&
$0 ~ /^{/)
printf "%s %d\n", FILENAME, NR
if ($0 ~ /^#define/)
was_define = "Y"
else
was_define = "N"
}' "$FILE"
grep -on '^#define.*{' "$FILE" | grep -v 'do[ ]*{'
done
|