mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Add missing "do { ... } while(0)" in ODBC macros and add find_baddefs
script.
This commit is contained in:
19
src/tools/find_baddefs
Executable file
19
src/tools/find_baddefs
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
done
|
||||
|
Reference in New Issue
Block a user