Re: Small patch: fix warnings during compilation on FreeBSD

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Small patch: fix warnings during compilation on FreeBSD
Дата
Msg-id 1108.1457623250@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Small patch: fix warnings during compilation on FreeBSD  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Ответы Re: Small patch: fix warnings during compilation on FreeBSD  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
Список pgsql-hackers
Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
> I noticed that master branch of PostgreSQL currently compiles with
> warnings on FreeBSD 10.2 RELEASE:
> pg_locale.c:1290:12: warning: implicit declaration of function
> 'wcstombs_l' is invalid in C99 [-Wimplicit-function-declaration]

> The problem is that both procedures are declared in xlocale.h file
> which is not included in given context.

OK.

> Frankly I'm not sure what is a right way of fixing this.

Not like that, as it will break entirely on machines without xlocale.h
(which I presume is pretty nonstandard; it's certainly not mentioned
in the POSIX spec).  It will also break things on glibc, according to
this comment in our c-library.m4:

# Check for the locale_t type and find the right header file.  Mac OS
# X needs xlocale.h; standard is locale.h, but glibc also has an
# xlocale.h file that we should not use.

I think what we need is configure logic to find out where wcstombs_l()
is declared, and then #include <xlocale.h> only if it's necessary to get
that definition.  I haven't experimented but probably you could make such
a check with nested uses of AC_CHECK_DECL.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Patch to implement pg_current_logfile() function
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: Reworks of CustomScan serialization/deserialization