Re: Small patch: fix warnings during compilation on FreeBSD

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small patch: fix warnings during compilation on FreeBSD
Date: 2016-03-15 17:33:07
Message-ID: 5236.1458063187@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru> writes:
> OK, I'm not an expert in Autotools but this patch (see attachment) seems
> to solve a problem.

I fooled around with this some. I felt originally that it should use
AC_CHECK_DECL, but that turns out not to work because AC_CHECK_DECL
has caching behavior built-in and so the second call did nothing.
However, we should still adopt the probe methodology it uses rather
than inventing our own; basically that's

#ifndef wcstombs_l
(void) wcstombs_l;
#endif

Also, after reviewing the bidding a bit more it seems likely to me
that wcstombs_l() might be declared in <locale.h> on some platforms;
which would be problematic for this test as written if <xlocale.h>
pulls in <locale.h>. So the right way to make the comparison is to
determine whether stdlib.h+locale.h+xlocale.h succeeds where
stdlib.h+locale.h fails.

I've checked this on my OS X box, which turns out to have the interesting
property that xlocale.h declares wcstombs_l(), but only if you previously
included stdlib.h ... wtf? But anyway that behavior is part of the
motivation for leaving stdlib.h in the test.

Please verify that the committed version solves your problem on FreeBSD.

> Please note that these changes:
> ... were generated but `autoreconf -iv`. I was not sure what to do
> about them. Eventually I decided to keep them. Still these changes could
> be safely discarded.

Yeah, it's not uncommon for platforms to carry local patches in their
autoconf packages, which results in changes like these. We make a point
of generating our configure using unmodified GNU autoconf installations,
so as to avoid dependencies on which platform a committer was using to
run autoconf.

regards, tom lane

Attachment Content-Type Size
check-for-mbstowcs-l-in-xlocale.patch text/x-diff 5.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-03-15 17:33:34 Re: [PROPOSAL] VACUUM Progress Checker.
Previous Message Corey Huinker 2016-03-15 17:30:56 Re: Soliciting Feedback on Improving Server-Side Programming Documentation