multiple exception definition in pg_type.h -> error compiling postgres support in Qt with gcc v3.2 (SuSE 8.1) - Mailing list pgsql-bugs

From ftm.van.vugt@foxi.nl
Subject multiple exception definition in pg_type.h -> error compiling postgres support in Qt with gcc v3.2 (SuSE 8.1)
Date
Msg-id 20021015135404.0088B475BC3@postgresql.org
Whole thread Raw
Responses Re: multiple exception definition in pg_type.h -> error compiling postgres support in Qt with gcc v3.2 (SuSE 8.1)
List pgsql-bugs
Your name               :       Frank van Vugt
Your email address      :       ftm.van.vugt@foxi.nl

(with thanks to Dimitri@TrollTech for his insight & examples)

System Configuration
---------------------
  Architecture  :
        Intel Pentium III

  Operating System :
        Linux 2.4.19 with glibc 2.2.5 (SuSE v8.1)

  PostgreSQL version :
        PostgreSQL-7.2.3

  Compiler used :
        gcc v3.2


Please enter a FULL description of your problem:
------------------------------------------------

Postgresql itself compiles like a breeze, no problem there.
Config line: "./configure  --with-openssl --with-perl --with-CXX"

Upon compiling TrollTech's Qt-library with postgresql support, the process
fails on numerous lines in pg_type.h with the following message:

> In file included from sql/drivers/psql/qsql_psql.cpp:49:
> /usr/src/postgresql/src/include/catalog/pg_type.h:196: declaration of
> `int*
>    __errno_location()' throws different exceptions
> /usr/src/postgresql/src/include/catalog/pg_type.h:195: than previous
>    declaration `int* __errno_location() throw ()'
> [...]




Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

The problem is caused by lines such as:
        DATA(insert OID = 16 (  bool       PGUID  1   1 t b ... _null_ ));
        DESCR("boolean, 'true'/'false'");

Since DATA and DESCR are defined in postgres.h:
        /* these need to expand into some harmless, repeatable declaration */
        #define DATA(x)   extern int errno
        #define DESCR(x)  extern int errno

These lines are eventually expanded into:
        extern int errno;
        extern int errno;

Obviously, compiling the following source produces the same problem:

        #include <errno.h>
        extern int errno;
        extern int errno;

Postgresql itself seems to never include <errno.h> along with
<catalog/pg_type.h>, otherwise it would suffer from the same problem



If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

We might want to expand ( 'DATA', 'DESCR' ) into something else, one of them
anyway ;-)

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #797: Inaccurate in PostgreSQL 7.3b2 Developer's Guide
Next
From: Tom Lane
Date:
Subject: Re: spurious "UNIQUE constraint matching given keys for referenced table" error