pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[PATCH] Suppress Clang 3.9 warnings
18+ messages / 7 participants
[nested] [flat]

Commits from this thread:
  2017-03-28 8cfeaecfc7 8433e0b40e 16e8152791  Suppress implicit-conversion warnings seen with newer clang versions.
* [PATCH] Suppress Clang 3.9 warnings
@ 2017-02-20 14:12 Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 14:26 ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 2 replies; 18+ messages in thread

From: Aleksander Alekseev @ 2017-02-20 14:12 UTC (permalink / raw)
  To: pgsql-hackers

Hello.

I've just tried to build PostgreSQL with Clang 3.9.1 (default version
currently available in Arch Linux) and noticed that it outputs lots of
warning messages. Most of them are result of a bug in Clang itself:

```
postinit.c:846:3: note: include the header <string.h> or explicitly
provide a declaration for 'strlcpy'
```

I've reported it to Clang developers almost a year ago but apparently
no one cares. You can find all the details in a corresponding thread
[1]. Frankly I'm not sure what to do about it. 

The rest of warnings looks more like something we could easily deal with:

```
xloginsert.c:742:18: warning: implicit conversion from 'int' to 'char'
changes value from 253 to -3 [-Wconstant-conversion]
```

Patch that fixes these warnings is attached to this email.

[1] http://lists.llvm.org/pipermail/cfe-dev/2016-March/048126.html

-- 
Best regards,
Aleksander Alekseev

Attachments:

suppress-clang39-warnings.patch (text/x-diff, 2.1K) download diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index f23e108628..0007010b25 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5015,7 +5015,7 @@ BootStrapXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; /* fill the XLogRecordDataHeaderShort struct */ - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(checkPoint); memcpy(recptr, &checkPoint, sizeof(checkPoint)); recptr += sizeof(checkPoint); diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index 03b05f937f..ea8e915029 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -739,7 +739,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, if ((curinsert_flags & XLOG_INCLUDE_ORIGIN) && replorigin_session_origin != InvalidRepOriginId) { - *(scratch++) = XLR_BLOCK_ID_ORIGIN; + *(scratch++) = (char)XLR_BLOCK_ID_ORIGIN; memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_origin)); scratch += sizeof(replorigin_session_origin); } @@ -749,13 +749,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, { if (mainrdata_len > 255) { - *(scratch++) = XLR_BLOCK_ID_DATA_LONG; + *(scratch++) = (char)XLR_BLOCK_ID_DATA_LONG; memcpy(scratch, &mainrdata_len, sizeof(uint32)); scratch += sizeof(uint32); } else { - *(scratch++) = XLR_BLOCK_ID_DATA_SHORT; + *(scratch++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(scratch++) = (uint8) mainrdata_len; } rdt_datas_last->next = mainrdata_head; diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 96b7097f8b..9165da1ee5 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -1100,7 +1100,7 @@ WriteEmptyXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(CheckPoint); memcpy(recptr, &ControlFile.checkPointCopy, sizeof(CheckPoint));
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-02-20 14:26 ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 14:34   ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  1 sibling, 1 reply; 18+ messages in thread

From: Tom Lane @ 2017-02-20 14:26 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: pgsql-hackers

Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
> I've just tried to build PostgreSQL with Clang 3.9.1 (default version
> currently available in Arch Linux) and noticed that it outputs lots of
> warning messages. Most of them are result of a bug in Clang itself:
> 
> postinit.c:846:3: note: include the header <string.h> or explicitly
> provide a declaration for 'strlcpy'

It might be an incompatibility with the platform-supplied string.h
rather than an outright bug, but yeah, that's pretty annoying.

> The rest of warnings looks more like something we could easily deal with:

It's hard to get excited about these if there are going to be hundreds
of the other ones ...

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 14:26 ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-02-20 14:34   ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 15:37     ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 18+ messages in thread

From: Aleksander Alekseev @ 2017-02-20 14:34 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-hackers

In theory - could we just always use our internal strl* implementations? 

On Mon, Feb 20, 2017 at 09:26:44AM -0500, Tom Lane wrote:
> Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
> > I've just tried to build PostgreSQL with Clang 3.9.1 (default version
> > currently available in Arch Linux) and noticed that it outputs lots of
> > warning messages. Most of them are result of a bug in Clang itself:
> > 
> > postinit.c:846:3: note: include the header <string.h> or explicitly
> > provide a declaration for 'strlcpy'
> 
> It might be an incompatibility with the platform-supplied string.h
> rather than an outright bug, but yeah, that's pretty annoying.
> 
> > The rest of warnings looks more like something we could easily deal with:
> 
> It's hard to get excited about these if there are going to be hundreds
> of the other ones ...
> 
> 			regards, tom lane

-- 
Best regards,
Aleksander Alekseev

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 14:26 ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 14:34   ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-02-20 15:37     ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 15:48       ` Re: [PATCH] Suppress Clang 3.9 warnings Tomas Vondra <tomas.vondra@2ndquadrant.com>
  0 siblings, 1 reply; 18+ messages in thread

From: Tom Lane @ 2017-02-20 15:37 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: pgsql-hackers

Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
> In theory - could we just always use our internal strl* implementations? 

Hmm, maybe configure's test to see if a declaration has been provided
is going wrong?  I notice that anchovy, which is supposedly current
Arch Linux, doesn't think the platform has it:

checking whether strlcat is declared... no
checking whether strlcpy is declared... no
...
checking for strlcat... no
checking for strlcpy... no

But that's using gcc.  Perhaps clang behaves differently?

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 14:26 ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 14:34   ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 15:37     ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-02-20 15:48       ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
  2017-02-20 15:56         ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 18+ messages in thread

From: Tomas Vondra @ 2017-02-20 15:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: pgsql-hackers

On 02/20/2017 04:37 PM, Tom Lane wrote:
> Aleksander Alekseev <a.alekseev@postgrespro.ru> writes:
>> In theory - could we just always use our internal strl* implementations?
>
> Hmm, maybe configure's test to see if a declaration has been provided
> is going wrong?  I notice that anchovy, which is supposedly current
> Arch Linux, doesn't think the platform has it:
>
> checking whether strlcat is declared... no
> checking whether strlcpy is declared... no
> ...
> checking for strlcat... no
> checking for strlcpy... no
>
> But that's using gcc.  Perhaps clang behaves differently?
>

AFAIK it happens because clang treats missing declarations as warnings, 
which confuses configure:

https://bugs.llvm.org//show_bug.cgi?id=20820

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 14:26 ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 14:34   ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-20 15:37     ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-02-20 15:48       ` Re: [PATCH] Suppress Clang 3.9 warnings Tomas Vondra <tomas.vondra@2ndquadrant.com>
@ 2017-02-20 15:56         ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 18+ messages in thread

From: Tom Lane @ 2017-02-20 15:56 UTC (permalink / raw)
  To: Tomas Vondra <tomas.vondra@2ndquadrant.com>; +Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>; pgsql-hackers

Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On 02/20/2017 04:37 PM, Tom Lane wrote:
>> But that's using gcc.  Perhaps clang behaves differently?

> AFAIK it happens because clang treats missing declarations as warnings, 
> which confuses configure:
> https://bugs.llvm.org//show_bug.cgi?id=20820

Ah, right.  Looks like the autoconf people still haven't made a
release incorporating the fix Noah provided :-(

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-02-22 14:43 ` Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  1 sibling, 1 reply; 18+ messages in thread

From: Fabien COELHO @ 2017-02-22 14:43 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: pgsql-hackers


Hello Aleksander,

> ```
> xloginsert.c:742:18: warning: implicit conversion from 'int' to 'char'
> changes value from 253 to -3 [-Wconstant-conversion]
> ```

There is a bunch of these in "xlog.c" as well, and the same code is used 
in "pg_resetwal.c".

> Patch that fixes these warnings is attached to this email.

My 0.02€:

I'm not at ease at putting the thing bluntly under the carpet with a cast.

Why not update the target type to "unsigned char" instead, so that no cast 
is needed and the value compatibility is checked by the compiler? I guess 
there would be some more changes (question is how much), but it would be 
cleaner.

-- 
Fabien.
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
@ 2017-03-13 14:19   ` David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  0 siblings, 1 reply; 18+ messages in thread

From: David Steele @ 2017-03-13 14:19 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: pgsql-hackers

Hi Aleksander,

On 2/22/17 9:43 AM, Fabien COELHO wrote:
> 
> Hello Aleksander,
> 
>> ```
>> xloginsert.c:742:18: warning: implicit conversion from 'int' to 'char'
>> changes value from 253 to -3 [-Wconstant-conversion]
>> ```
> 
> There is a bunch of these in "xlog.c" as well, and the same code is used
> in "pg_resetwal.c".
> 
>> Patch that fixes these warnings is attached to this email.
> 
> My 0.02€:
> 
> I'm not at ease at putting the thing bluntly under the carpet with a cast.
> 
> Why not update the target type to "unsigned char" instead, so that no
> cast is needed and the value compatibility is checked by the compiler? I
> guess there would be some more changes (question is how much), but it
> would be cleaner.

There's been no discussion or new patch on this thread recently.  If you
are planning to address the issues raised please plan to do so by
Thursday, March 16th.

If no new patch is submitted by that date I will mark this patch
"Returned with Feedback".

Thanks,
-- 
-David
david@pgmasters.net


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
@ 2017-03-13 15:35     ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-17 22:02       ` Re: [PATCH] Suppress Clang 3.9 warnings Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 2 replies; 18+ messages in thread

From: Aleksander Alekseev @ 2017-03-13 15:35 UTC (permalink / raw)
  To: David Steele <david@pgmasters.net>; +Cc: pgsql-hackers

Hi David,

Thank you for reminding about this patch!

Here is a new patch. I tried to make as little changes as possible. This
is no doubt not the most beautiful patch on Earth but it removes all
warnings. I anyone could suggest an approach that would be significantly
better please don't hesitate to share your ideas.

Tested on Clang 3.9.1 and GCC 6.3.1.

> Why not update the target type to "unsigned char" instead, so that no
> cast is needed and the value compatibility is checked by the compiler? I
> guess there would be some more changes (question is how much), but it
> would be cleaner.

I tried this way as well. After rebuilding PostgreSQL in 5th time I
discovered that now I have to redefine a Poiner typedef. I don't think
we can avoid using type casts. There will be just different type casts
in other places, or we'll have to break most of existing PostgreSQL
extensions.

On Mon, Mar 13, 2017 at 10:19:57AM -0400, David Steele wrote:
> Hi Aleksander,
> 
> On 2/22/17 9:43 AM, Fabien COELHO wrote:
> > 
> > Hello Aleksander,
> > 
> >> ```
> >> xloginsert.c:742:18: warning: implicit conversion from 'int' to 'char'
> >> changes value from 253 to -3 [-Wconstant-conversion]
> >> ```
> > 
> > There is a bunch of these in "xlog.c" as well, and the same code is used
> > in "pg_resetwal.c".
> > 
> >> Patch that fixes these warnings is attached to this email.
> > 
> > My 0.02€:
> > 
> > I'm not at ease at putting the thing bluntly under the carpet with a cast.
> > 
> > Why not update the target type to "unsigned char" instead, so that no
> > cast is needed and the value compatibility is checked by the compiler? I
> > guess there would be some more changes (question is how much), but it
> > would be cleaner.
> 
> There's been no discussion or new patch on this thread recently.  If you
> are planning to address the issues raised please plan to do so by
> Thursday, March 16th.
> 
> If no new patch is submitted by that date I will mark this patch
> "Returned with Feedback".
> 
> Thanks,
> -- 
> -David
> david@pgmasters.net

-- 
Best regards,
Aleksander Alekseev

Attachments:

suppress-clang39-warnings-v2.patch (text/x-diff, 3.1K) download diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 744360c769..6aa93b5ff7 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5018,7 +5018,7 @@ BootStrapXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; /* fill the XLogRecordDataHeaderShort struct */ - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(checkPoint); memcpy(recptr, &checkPoint, sizeof(checkPoint)); recptr += sizeof(checkPoint); diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index 03b05f937f..ea8e915029 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -739,7 +739,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, if ((curinsert_flags & XLOG_INCLUDE_ORIGIN) && replorigin_session_origin != InvalidRepOriginId) { - *(scratch++) = XLR_BLOCK_ID_ORIGIN; + *(scratch++) = (char)XLR_BLOCK_ID_ORIGIN; memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_origin)); scratch += sizeof(replorigin_session_origin); } @@ -749,13 +749,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, { if (mainrdata_len > 255) { - *(scratch++) = XLR_BLOCK_ID_DATA_LONG; + *(scratch++) = (char)XLR_BLOCK_ID_DATA_LONG; memcpy(scratch, &mainrdata_len, sizeof(uint32)); scratch += sizeof(uint32); } else { - *(scratch++) = XLR_BLOCK_ID_DATA_SHORT; + *(scratch++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(scratch++) = (uint8) mainrdata_len; } rdt_datas_last->next = mainrdata_head; diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 27bd9b04e7..ed6968d605 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -1095,7 +1095,7 @@ WriteEmptyXLOG(void) record->xl_rmid = RM_XLOG_ID; recptr += SizeOfXLogRecord; - *(recptr++) = XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) = (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) = sizeof(CheckPoint); memcpy(recptr, &ControlFile.checkPointCopy, sizeof(CheckPoint)); diff --git a/src/include/port.h b/src/include/port.h index f4546016e7..0f014b72b6 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -395,11 +395,22 @@ extern double rint(double x); extern int inet_aton(const char *cp, struct in_addr * addr); #endif -#if !HAVE_DECL_STRLCAT +/* + * Unfortunately in case of strlcat and strlcpy we can't trust tests + * executed by Autotools if Clang > 3.6 is used. Clang manages to compile + * a program that shouldn't compile which causes wrong values of + * HAVE_DECL_STRLCAT and HAVE_DECL_STRLCPY. More details could be found here: + * + * http://lists.llvm.org/pipermail/cfe-dev/2016-March/048126.html + * + * This is no doubt a dirty hack but apparently alternative solutions are + * not much better. + */ +#if !HAVE_DECL_STRLCAT || defined(__clang__) extern size_t strlcat(char *dst, const char *src, size_t siz); #endif -#if !HAVE_DECL_STRLCPY +#if !HAVE_DECL_STRLCPY || defined(__clang__) extern size_t strlcpy(char *dst, const char *src, size_t siz); #endif
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-03-15 02:25       ` Noah Misch <noah@leadboat.com>
  2017-03-15 09:04         ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 14:57         ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 2 replies; 18+ messages in thread

From: Noah Misch @ 2017-03-15 02:25 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: David Steele <david@pgmasters.net>; pgsql-hackers

On Mon, Mar 13, 2017 at 06:35:53PM +0300, Aleksander Alekseev wrote:
> --- a/src/include/port.h
> +++ b/src/include/port.h
> @@ -395,11 +395,22 @@ extern double rint(double x);
>  extern int	inet_aton(const char *cp, struct in_addr * addr);
>  #endif
>  
> -#if !HAVE_DECL_STRLCAT
> +/*
> + * Unfortunately in case of strlcat and strlcpy we can't trust tests
> + * executed by Autotools if Clang > 3.6 is used. Clang manages to compile
> + * a program that shouldn't compile which causes wrong values of
> + * HAVE_DECL_STRLCAT and HAVE_DECL_STRLCPY. More details could be found here:
> + *
> + * http://lists.llvm.org/pipermail/cfe-dev/2016-March/048126.html
> + *
> + * This is no doubt a dirty hack but apparently alternative solutions are
> + * not much better.
> + */
> +#if !HAVE_DECL_STRLCAT || defined(__clang__)
>  extern size_t strlcat(char *dst, const char *src, size_t siz);
>  #endif
>  
> -#if !HAVE_DECL_STRLCPY
> +#if !HAVE_DECL_STRLCPY || defined(__clang__)
>  extern size_t strlcpy(char *dst, const char *src, size_t siz);
>  #endif

This is wrong on platforms that do have strlcpy() in libc.

If I recall correctly, you can suppress the warnings in your own build by
adding "ac_cv_func_strlcpy=no ac_cv_have_decl_strlcpy=no ac_cv_func_strlcat=no
ac_cv_have_decl_strlcat=no" to the "configure" command line.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
@ 2017-03-15 09:04         ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-16 06:55           ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  1 sibling, 1 reply; 18+ messages in thread

From: Aleksander Alekseev @ 2017-03-15 09:04 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: David Steele <david@pgmasters.net>; pgsql-hackers

Hi Hoah.

Thanks a lot for a reply!

> This is wrong on platforms that do have strlcpy() in libc.

If it no too much trouble could you please explain what will happen
on such platforms? On what platform did you check it? I'm sure it
fixable. And I got a strong feeling that "wrong" could be a bit exaggerated.

> If I recall correctly, you can suppress the warnings in your own build by
> adding "ac_cv_func_strlcpy=no ac_cv_have_decl_strlcpy=no ac_cv_func_strlcat=no
> ac_cv_have_decl_strlcat=no" to the "configure" command line.

It's not exactly what I would call a solution. For instance on FreeBSD
Clang is a default compiler and many users build a software from source
code (FreeBSD ports). For some reason I doubt that many of them know
about these flags.

On Wed, Mar 15, 2017 at 02:25:38AM +0000, Noah Misch wrote:
> On Mon, Mar 13, 2017 at 06:35:53PM +0300, Aleksander Alekseev wrote:
> > --- a/src/include/port.h
> > +++ b/src/include/port.h
> > @@ -395,11 +395,22 @@ extern double rint(double x);
> >  extern int	inet_aton(const char *cp, struct in_addr * addr);
> >  #endif
> >  
> > -#if !HAVE_DECL_STRLCAT
> > +/*
> > + * Unfortunately in case of strlcat and strlcpy we can't trust tests
> > + * executed by Autotools if Clang > 3.6 is used. Clang manages to compile
> > + * a program that shouldn't compile which causes wrong values of
> > + * HAVE_DECL_STRLCAT and HAVE_DECL_STRLCPY. More details could be found here:
> > + *
> > + * http://lists.llvm.org/pipermail/cfe-dev/2016-March/048126.html
> > + *
> > + * This is no doubt a dirty hack but apparently alternative solutions are
> > + * not much better.
> > + */
> > +#if !HAVE_DECL_STRLCAT || defined(__clang__)
> >  extern size_t strlcat(char *dst, const char *src, size_t siz);
> >  #endif
> >  
> > -#if !HAVE_DECL_STRLCPY
> > +#if !HAVE_DECL_STRLCPY || defined(__clang__)
> >  extern size_t strlcpy(char *dst, const char *src, size_t siz);
> >  #endif
> 
> This is wrong on platforms that do have strlcpy() in libc.
> 
> If I recall correctly, you can suppress the warnings in your own build by
> adding "ac_cv_func_strlcpy=no ac_cv_have_decl_strlcpy=no ac_cv_func_strlcat=no
> ac_cv_have_decl_strlcat=no" to the "configure" command line.

-- 
Best regards,
Aleksander Alekseev

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 09:04         ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-03-16 06:55           ` Noah Misch <noah@leadboat.com>
  2017-03-16 14:17             ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 18+ messages in thread

From: Noah Misch @ 2017-03-16 06:55 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; +Cc: David Steele <david@pgmasters.net>; pgsql-hackers

This mailing list does not welcome top-post replies.

On Wed, Mar 15, 2017 at 12:04:11PM +0300, Aleksander Alekseev wrote:
> > This is wrong on platforms that do have strlcpy() in libc.
> 
> If it no too much trouble could you please explain what will happen
> on such platforms?

Both port.h and a system header will furnish a strlcpy() declaration.  The #if
you modified exists to avoid that, and your change would make it ineffective
for Clang.  This will have no symptoms, or it will elicit a warning.

> On what platform did you check it?

None.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 09:04         ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-16 06:55           ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
@ 2017-03-16 14:17             ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 18+ messages in thread

From: Tom Lane @ 2017-03-16 14:17 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>; David Steele <david@pgmasters.net>; pgsql-hackers

Noah Misch <noah@leadboat.com> writes:
> On Wed, Mar 15, 2017 at 12:04:11PM +0300, Aleksander Alekseev wrote:
>> If it no too much trouble could you please explain what will happen
>> on such platforms?

> Both port.h and a system header will furnish a strlcpy() declaration.  The #if
> you modified exists to avoid that, and your change would make it ineffective
> for Clang.  This will have no symptoms, or it will elicit a warning.

The reason why this is bad is that port.h's declaration might be different
from the system headers'.  That's not hypothetical; for example, on my
Mac laptop, strlcpy is declared

size_t strlcpy(char * restrict dst, const char * restrict src, size_t size);

whereas of course there's no "restrict" in port.h.  To make matters worse,
it looks like strlcpy is actually a macro expanding to
'__builtin___strlcpy_chk'.  And the compiler on this box *is* clang,
meaning the proposed patch would affect it.  When I try it, I get
boatloads of errors (not warnings) like these:

In file included from ../../src/include/postgres_fe.h:25:
In file included from ../../src/include/c.h:1125:
../../src/include/port.h:403:15: error: expected parameter declarator
extern size_t strlcpy(char *dst, const char *src, size_t siz);
              ^
/usr/include/secure/_string.h:105:44: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
                                           ^

../../src/include/port.h:403:15: error: conflicting types for '__builtin___strlcpy_chk'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'

In short, if this were to get committed, it would get reverted within
minutes, because more than a few of us use Macs.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
@ 2017-03-15 14:57         ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-03-15 16:09           ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  1 sibling, 1 reply; 18+ messages in thread

From: Tom Lane @ 2017-03-15 14:57 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>; David Steele <david@pgmasters.net>; pgsql-hackers

Noah Misch <noah@leadboat.com> writes:
> On Mon, Mar 13, 2017 at 06:35:53PM +0300, Aleksander Alekseev wrote:
>> + * Unfortunately in case of strlcat and strlcpy we can't trust tests
>> + * executed by Autotools if Clang > 3.6 is used.

> This is wrong on platforms that do have strlcpy() in libc.

Didn't you submit a patch to upstream autoconf awhile ago to fix the
AC_CHECK_DECLS test for this?  Seems like the correct solution is to
absorb that fix, either by updating to a newer autoconf release or by
carrying our own version of AC_CHECK_DECLS until they come out with one.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 14:57         ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-03-15 16:09           ` Noah Misch <noah@leadboat.com>
  2017-03-15 16:21             ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 18+ messages in thread

From: Noah Misch @ 2017-03-15 16:09 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>; David Steele <david@pgmasters.net>; pgsql-hackers

On Wed, Mar 15, 2017 at 10:57:15AM -0400, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Mon, Mar 13, 2017 at 06:35:53PM +0300, Aleksander Alekseev wrote:
> >> + * Unfortunately in case of strlcat and strlcpy we can't trust tests
> >> + * executed by Autotools if Clang > 3.6 is used.
> 
> > This is wrong on platforms that do have strlcpy() in libc.
> 
> Didn't you submit a patch to upstream autoconf awhile ago to fix the
> AC_CHECK_DECLS test for this?

Yes.

> Seems like the correct solution is to
> absorb that fix, either by updating to a newer autoconf release or by
> carrying our own version of AC_CHECK_DECLS until they come out with one.

As you mention upthread, that Autoconf commit is still newer than every
Autoconf release.  (Last release was 58 months ago.)  Altering configure.ac to
work around the bug would be reasonable, but it feels heavy relative to the
benefit of suppressing some warnings.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 14:57         ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-03-15 16:09           ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
@ 2017-03-15 16:21             ` Tom Lane <tgl@sss.pgh.pa.us>
  2017-03-24 12:52               ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  0 siblings, 1 reply; 18+ messages in thread

From: Tom Lane @ 2017-03-15 16:21 UTC (permalink / raw)
  To: Noah Misch <noah@leadboat.com>; +Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>; David Steele <david@pgmasters.net>; pgsql-hackers

Noah Misch <noah@leadboat.com> writes:
> On Wed, Mar 15, 2017 at 10:57:15AM -0400, Tom Lane wrote:
>> Seems like the correct solution is to
>> absorb that fix, either by updating to a newer autoconf release or by
>> carrying our own version of AC_CHECK_DECLS until they come out with one.

> As you mention upthread, that Autoconf commit is still newer than every
> Autoconf release.  (Last release was 58 months ago.)  Altering configure.ac to
> work around the bug would be reasonable, but it feels heavy relative to the
> benefit of suppressing some warnings.

It does seem like rather a lot of work, but I think it's preferable to
hacking up the coding in port.h.  Mainly because we could booby-trap the
substitute AC_CHECK_DECLS to make sure we revert it whenever autoconf 2.70
does materialize (a check on m4_PACKAGE_VERSION, like the one at
configure.in line 22, ought to do the trick); whereas I do not think
we'd remember to de-kluge port.h if we kluge around it there.

I'm fine with leaving it alone, too.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-03-15 02:25       ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 14:57         ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
  2017-03-15 16:09           ` Re: [PATCH] Suppress Clang 3.9 warnings Noah Misch <noah@leadboat.com>
  2017-03-15 16:21             ` Re: [PATCH] Suppress Clang 3.9 warnings Tom Lane <tgl@sss.pgh.pa.us>
@ 2017-03-24 12:52               ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
  0 siblings, 0 replies; 18+ messages in thread

From: Aleksander Alekseev @ 2017-03-24 12:52 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Noah Misch <noah@leadboat.com>; David Steele <david@pgmasters.net>; pgsql-hackers

Hi Tom,

Since no one seems to be particularly excited about this patch I'm
marking it as "Returned with feedback" to save reviewers time.

On Wed, Mar 15, 2017 at 12:21:21PM -0400, Tom Lane wrote:
> Noah Misch <noah@leadboat.com> writes:
> > On Wed, Mar 15, 2017 at 10:57:15AM -0400, Tom Lane wrote:
> >> Seems like the correct solution is to
> >> absorb that fix, either by updating to a newer autoconf release or by
> >> carrying our own version of AC_CHECK_DECLS until they come out with one.
> 
> > As you mention upthread, that Autoconf commit is still newer than every
> > Autoconf release.  (Last release was 58 months ago.)  Altering configure.ac to
> > work around the bug would be reasonable, but it feels heavy relative to the
> > benefit of suppressing some warnings.
> 
> It does seem like rather a lot of work, but I think it's preferable to
> hacking up the coding in port.h.  Mainly because we could booby-trap the
> substitute AC_CHECK_DECLS to make sure we revert it whenever autoconf 2.70
> does materialize (a check on m4_PACKAGE_VERSION, like the one at
> configure.in line 22, ought to do the trick); whereas I do not think
> we'd remember to de-kluge port.h if we kluge around it there.
> 
> I'm fine with leaving it alone, too.
> 
> 			regards, tom lane

-- 
Best regards,
Aleksander Alekseev

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 18+ messages in thread

* Re: [PATCH] Suppress Clang 3.9 warnings
  2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
  2017-02-22 14:43 ` Re: [PATCH] Suppress Clang 3.9 warnings Fabien COELHO <coelho@cri.ensmp.fr>
  2017-03-13 14:19   ` Re: [PATCH] Suppress Clang 3.9 warnings David Steele <david@pgmasters.net>
  2017-03-13 15:35     ` Re: [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
@ 2017-03-17 22:02       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  1 sibling, 0 replies; 18+ messages in thread

From: Peter Eisentraut @ 2017-03-17 22:02 UTC (permalink / raw)
  To: Aleksander Alekseev <a.alekseev@postgrespro.ru>; David Steele <david@pgmasters.net>; +Cc: pgsql-hackers

On 3/13/17 11:35, Aleksander Alekseev wrote:
> Here is a new patch. I tried to make as little changes as possible. This
> is no doubt not the most beautiful patch on Earth but it removes all
> warnings. I anyone could suggest an approach that would be significantly
> better please don't hesitate to share your ideas.

I'm also seeing the -Wconstant-conversion warnings with clang-4.0.  The
warnings about strlcpy don't appear here.  That might be something
specific to the operating system.

To address the -Wconstant-conversion warnings, I suggest changing the
variables to unsigned char * as appropriate.

However, this would require a large number of changes to all call sites
of XLogRegisterData(), because they all have a cast like this:

    XLogRegisterData((char *) &xlrec, SizeOfHashMovePageContents);

Perhaps the first argument could be changed to void *.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 18+ messages in thread


end of thread, other threads:[~2017-03-24 12:52 UTC | newest]

Thread overview: 18+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 14:12 [PATCH] Suppress Clang 3.9 warnings Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-02-20 14:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-02-20 14:34   ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-02-20 15:37     ` Tom Lane <tgl@sss.pgh.pa.us>
2017-02-20 15:48       ` Tomas Vondra <tomas.vondra@2ndquadrant.com>
2017-02-20 15:56         ` Tom Lane <tgl@sss.pgh.pa.us>
2017-02-22 14:43 ` Fabien COELHO <coelho@cri.ensmp.fr>
2017-03-13 14:19   ` David Steele <david@pgmasters.net>
2017-03-13 15:35     ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-03-15 02:25       ` Noah Misch <noah@leadboat.com>
2017-03-15 09:04         ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-03-16 06:55           ` Noah Misch <noah@leadboat.com>
2017-03-16 14:17             ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-15 14:57         ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-15 16:09           ` Noah Misch <noah@leadboat.com>
2017-03-15 16:21             ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-24 12:52               ` Aleksander Alekseev <a.alekseev@postgrespro.ru>
2017-03-17 22:02       ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox