From: Aleksander Alekseev <a.alekseev@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Subject: [PATCH] Suppress Clang 3.9 warnings
Date: Mon, 20 Feb 2017 17:12:39 +0300
Message-ID: <20170220141239.GD12278@e733.localdomain> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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) downloaddiff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.cindex 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.cindex 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.cindex 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: a.alekseev@postgrespro.ru
Subject: Re: [PATCH] Suppress Clang 3.9 warnings
In-Reply-To: <20170220141239.GD12278@e733.localdomain>
References: <20170220141239.GD12278@e733.localdomain>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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