head	1.1;
access;
symbols
	REL9_0_0:1.1
	REL9_1_ALPHA1:1.1
	REL9_0_RC1:1.1
	REL9_0_BETA4:1.1
	REL9_0_STABLE:1.1.0.12
	REL9_0_BETA3:1.1
	REL9_0_BETA2:1.1
	REL9_0_BETA1:1.1
	REL9_0_ALPHA5_BRANCH:1.1.0.10
	REL9_0_ALPHA5:1.1
	REL9_0_ALPHA4:1.1
	REL9_0_ALPHA4_BRANCH:1.1.0.8
	REL8_5_ALPHA3:1.1
	REL8_5_ALPHA3_BRANCH:1.1.0.6
	REL8_5_ALPHA2:1.1
	REL8_5_ALPHA2_BRANCH:1.1.0.4
	REL8_5_ALPHA1:1.1
	REL8_5_ALPHA1_BRANCH:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2009.07.16.06.33.46;	author petere;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Make backend header files C++ safe

This alters various incidental uses of C++ key words to use other similar
identifiers, so that a C++ compiler won't choke outright.  You still
(probably) need extern "C" { }; around the inclusion of backend headers.

based on a patch by Kurt Harriman <harriman@@acm.org>

Also add a script cpluspluscheck to check for C++ compatibility in the
future.  As of right now, this passes without error for me.
@
text
@#!/bin/sh

# Check all include files in or below the current directory for C++
# compatibility.  Typically, run this in PostgreSQL's src/include/ directory.
# No output if everything is OK, else compiler errors.

set -e

me=`basename $0`

trap 'rm -rf $tmp' 0 1 2 3 15
tmp=`mktemp -d /tmp/$me.XXXXXX`

{
echo ' extern "C" {'
echo '#include "postgres.h"'

# Omit port/, because it's platform specific, and c.h includes it anyway. Omit
# regex/ and snowball/, because those files came from elsewhere, and they would
# need extra work if someone cared to fix them.  kwlist.h is not meant to be
# included directly.  rusagestub.h will be included by ./utils/pg_rusage.h if
# necessary.
for file in `find . \( -name port -prune -o -name regex -prune -o -name snowball -prune \) -o -name '*.h' -not -name kwlist.h -not -name rusagestub.h -print`; do
	f=`echo $file | sed 's,^\./,,'`
	echo "#include \"$f\""
done

echo '};'
} >$tmp/test.cpp

# -fno-operator-names omits the definition of bitand and bitor, which would
# collide with varbit.h.  Could be fixed, if one were so inclined.
${CXX:-g++} -I. -fsyntax-only -fno-operator-names -Wall -c $tmp/test.cpp
@
