Fix obsolete comment regarding FSM truncation.
[PostgreSQL.git] / src / tools / find_badmacros
blob26248ff7c150330eef84b76ace073c7d6102f5eb
1 #!/bin/sh
3 # This script attempts to find bad ifdef's, i.e. ifdef's that use braces
4 # but not the do { ... } while (0) syntax
6 # $PostgreSQL$
8 # This is useful for running before pgindent
10 for FILE
12 awk ' BEGIN {was_define = "N"}
13 { if (was_define == "Y" &&
14 $0 ~ /^{/)
15 printf "%s %d\n", FILENAME, NR
16 if ($0 ~ /^#define/)
17 was_define = "Y"
18 else
19 was_define = "N"
20 }' "$FILE"
21 grep -on '^#define.*{' "$FILE" | grep -v 'do[ ]*{'
22 done