Re: SPI-header-files safe for C++-compiler - Mailing list pgsql-patches

From Neil Conway
Subject Re: SPI-header-files safe for C++-compiler
Date
Msg-id 1183011990.6094.28.camel@goldbach
Whole thread Raw
In response to Re: SPI-header-files safe for C++-compiler  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Thu, 2007-28-06 at 02:07 -0400, Tom Lane wrote:
> It was already pointed out upthread that wrapping the inclusions in
> extern "C" {...} would fix the identifier part of the problem from
> the user side

No, my point about extern "C" was that I don't think we need to add it
to the Postgres headers. As far as I can see, it doesn't help with the
identifier part of the problem:

% cat foo.cpp
extern "C" {
#include "postgres.h"
#include "commands/trigger.h"
}

int
main(void)
{
    return 0;
}

% g++ -I$HOME/postgres/head/prefix/include/server foo.cpp
/home/neilc/postgres/head/prefix/include/server/nodes/primnodes.h:1078:
error: expected unqualified-id before 'using'
/home/neilc/postgres/head/prefix/include/server/nodes/primnodes.h:1078:
error: abstract declarator 'List*' used as declaration
/home/neilc/postgres/head/prefix/include/server/nodes/primnodes.h:1078:
error: expected ';' before 'using'
/home/neilc/postgres/head/prefix/include/server/nodes/parsenodes.h:167:
error: expected unqualified-id before 'typeid'
/home/neilc/postgres/head/prefix/include/server/nodes/parsenodes.h:238:
error: expected unqualified-id before 'typename'
[ ... and so on ... ]

-Neil



pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: SPI-header-files safe for C++-compiler
Next
From: Neil Conway
Date:
Subject: Re: psql: add volatility to \df+