You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
postgres/src/tools/find_badmacros

22 lines
492 B

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