head	1.3;
access;
symbols
	REL7_2_BETA3:1.2
	REL7_2_BETA2:1.2
	REL7_2_BETA1:1.2;
locks; strict;
comment	@# @;


1.3
date	2001.11.26.21.42.24;	author momjian;	state dead;
branches;
next	1.2;

1.2
date	2001.10.25.01.29.37;	author momjian;	state Exp;
branches;
next	1.1;

1.1
date	2001.10.25.00.50.50;	author momjian;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Rename find_baddefs to find_badmacros
@
text
@#!/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

@


1.2
log
@Add do { ... } while (0) to more bad macros.
@
text
@@


1.1
log
@Add missing "do { ... } while(0)" in ODBC macros and add find_baddefs
script.
@
text
@d17 2
a18 1
				}' $FILE
@

