Small patch: fix warnings during compilation on FreeBSD - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Small patch: fix warnings during compilation on FreeBSD
Date
Msg-id 20160310163632.53d8e2cc@fujitsu
Whole thread Raw
Responses Re: Small patch: fix warnings during compilation on FreeBSD
List pgsql-hackers
Hello

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]

result = wcstombs_l(to, from, tolen, locale);

pg_locale.c:1365:13: warning: implicit declaration of function
'mbstowcs_l' is invalid in C99 [-Wimplicit-function-declaration]

result = mbstowcs_l(to, str, tolen, locale);

2 warnings generated.
```

The problem is that both procedures are declared in xlocale.h file
which is not included in given context. If I remember correctly in
this case compiler assumes that procedures return `int` (instead of
size_t) so I doubt we can ignore this issue.

Frankly I'm not sure what is a right way of fixing this. My best guess
is attached to this message. I tested this patch on Ubuntu Linux 14.04
and FreeBSD 10.2. It solves a described problem and apparently doesn't
break anything (code compiles, regression tests pass, etc).

Best regards,
Aleksander
Attachment

pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: Identifying a message in emit_log_hook.
Next
From: Tomas Vondra
Date:
Subject: Re: Using quicksort for every external sort run