Issue with mkdtemp() in port.h

From: Caleb Welton <cwelton(at)pivotal(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Issue with mkdtemp() in port.h
Date: 2014-10-17 01:21:01
Message-ID: CAOjayEdXg+jTU0neRG66zyD66Z=8fp++47QXAae-uo8DE+iHcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

A little while back some users started complaining that the contrib module
I develop (MADlib) was failing to build with the following error:

------
/usr/include/postgresql/9.2/server/port.h:480:32: error: declaration of
'char* mkdtemp(char*)' has a different exception specifier
/usr/include/stdlib.h:663:14: error: from previous declaration 'char*
mkdtemp(char*) throw ()'
------

After some research I've tracked this down to the following commit from ~4
months ago:

------
https://github.com/postgres/postgres/commit/a919937f112eb2f548d5f9bd1b3a7298375e6380
------

Which added a definition of mkdtemp into port.h that conflicts with the
definition in the system header files.

The following is a simple program that demonstrates the issue:

------
bash$ cat /tmp/foo.cpp
#include "postgres.h"
int main() { return 0; }

bash$ gcc -o foo foo.cpp -I`pg_config --includedir-server` -pedantic
In file included from /usr/pgsql-9.2/include/server/c.h:860,
from /usr/pgsql-9.2/include/server/postgres.h:47,
from foo.cpp:1:
/usr/pgsql-9.2/include/server/port.h:479: error: declaration of ‘char*
mkdtemp(char*)’ throws different exceptions
/usr/include/stdlib.h:663: error: from previous declaration ‘char*
mkdtemp(char*) throw ()’
------

Reproducible on ubuntu 14.04, centos6, and likely others.

Regards,
Caleb

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2014-10-17 03:16:05 Re: Superuser connect during smart shutdown
Previous Message Robert Haas 2014-10-17 00:22:24 Re: WIP: dynahash replacement for buffer table