1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

Rename find_baddefs to find_badmacros

This commit is contained in:
Bruce Momjian
2001-11-26 21:42:24 +00:00
parent 2337780e0e
commit 07c3f00b14
2 changed files with 10 additions and 5 deletions

20
src/tools/find_badmacros Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# This script attempts to find bad ifdef's, i.e. ifdef's that use braces
# but not the do { ... } while (0) syntax
#
# 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