Re: pgsql: Refactor dlopen() support - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pgsql: Refactor dlopen() support
Date
Msg-id 22629.1536354791@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgsql: Refactor dlopen() support  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 07/09/2018 16:19, Tom Lane wrote:
>> Somehow or other, the changes you made in dfmgr.c's #include lines
>> have made it so that find_rendezvous_variable's local "bool found"
>> variable is actually of type _Bool (which is word-wide on these
>> machines).

> Ah because dlfcn.h includes stdbool.h.  Hmm.

Yeah, and that's still true as of current macOS, it seems.

I can make the problem go away with the attached patch (borrowed from
similar code in plperl.h).  It's kind of grotty but I'm not sure there's
a better way.

            regards, tom lane

diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index c2a2572..4a5cc7c 100644
*** a/src/backend/utils/fmgr/dfmgr.c
--- b/src/backend/utils/fmgr/dfmgr.c
***************
*** 18,24 ****
--- 18,34 ----

  #ifdef HAVE_DLOPEN
  #include <dlfcn.h>
+
+ /*
+  * On macOS, <dlfcn.h> insists on including <stdbool.h>.  If we're not
+  * using stdbool, undef bool to undo the damage.
+  */
+ #ifndef USE_STDBOOL
+ #ifdef bool
+ #undef bool
  #endif
+ #endif
+ #endif                            /* HAVE_DLOPEN */

  #include "fmgr.h"
  #include "lib/stringinfo.h"

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: libpq stricter integer parsing
Next
From: Fabien COELHO
Date:
Subject: Re: libpq stricter integer parsing