mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-11 09:23:30 +02:00
24 lines
552 B
Bash
Executable File
24 lines
552 B
Bash
Executable File
#!/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
|
|
|