Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfokq-0001gG-GB for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2017 14:15:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cfokp-0003CA-Px for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Feb 2017 14:15:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cfoko-0003Ba-VA for pgsql-hackers@postgresql.org; Mon, 20 Feb 2017 14:15:51 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cfokm-0003ZT-AE for pgsql-hackers@postgresql.org; Mon, 20 Feb 2017 14:15:50 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 49F9421C2302 for ; Mon, 20 Feb 2017 17:15:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Date: Mon, 20 Feb 2017 17:12:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1487600146; bh=e96k4jYtRv32yqTcZ3DTtJf8uMc3dEo10YT/1Q0VOSM=; h=From:To:Subject; b=CLIaFXXpVI2ZInZIB3JeRG0FKeQmaJJgyzaMWXnFpYvC4bFptGc7AQsjcL7U0uTu1 WCHEJ6sYpXt0wpIP7k1AFp/37YSwdMZhTQnVyC6F8IDlN5dUs/sMzSb6yzP4OMVO77 c/eBiVa+mGFTBJ92IvAGAk9BNG3aeUXJgNskX1ts= From: Aleksander Alekseev To: pgsql-hackers@postgresql.org Subject: [PATCH] Suppress Clang 3.9 warnings Message-ID: <20170220141239.GD12278@e733.localdomain> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Qz2CZ664xQdCRdPu" Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --Qz2CZ664xQdCRdPu Content-Type: multipart/mixed; boundary="BI5RvnYi6R4T2M87" Content-Disposition: inline --BI5RvnYi6R4T2M87 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 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.=20 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 --=20 Best regards, Aleksander Alekseev --BI5RvnYi6R4T2M87 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="suppress-clang39-warnings.patch" Content-Transfer-Encoding: quoted-printable 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 =3D RM_XLOG_ID; recptr +=3D SizeOfXLogRecord; /* fill the XLogRecordDataHeaderShort struct */ - *(recptr++) =3D XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) =3D (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) =3D sizeof(checkPoint); memcpy(recptr, &checkPoint, sizeof(checkPoint)); recptr +=3D sizeof(checkPoint); diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/t= ransam/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 !=3D InvalidRepOriginId) { - *(scratch++) =3D XLR_BLOCK_ID_ORIGIN; + *(scratch++) =3D (char)XLR_BLOCK_ID_ORIGIN; memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_or= igin)); scratch +=3D sizeof(replorigin_session_origin); } @@ -749,13 +749,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info, { if (mainrdata_len > 255) { - *(scratch++) =3D XLR_BLOCK_ID_DATA_LONG; + *(scratch++) =3D (char)XLR_BLOCK_ID_DATA_LONG; memcpy(scratch, &mainrdata_len, sizeof(uint32)); scratch +=3D sizeof(uint32); } else { - *(scratch++) =3D XLR_BLOCK_ID_DATA_SHORT; + *(scratch++) =3D (char)XLR_BLOCK_ID_DATA_SHORT; *(scratch++) =3D (uint8) mainrdata_len; } rdt_datas_last->next =3D mainrdata_head; diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_res= etwal.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 =3D RM_XLOG_ID; =20 recptr +=3D SizeOfXLogRecord; - *(recptr++) =3D XLR_BLOCK_ID_DATA_SHORT; + *(recptr++) =3D (char)XLR_BLOCK_ID_DATA_SHORT; *(recptr++) =3D sizeof(CheckPoint); memcpy(recptr, &ControlFile.checkPointCopy, sizeof(CheckPoint)); --BI5RvnYi6R4T2M87-- --Qz2CZ664xQdCRdPu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEECAokn0QZCoIHW4GpEEnCBLXCDtYFAliq+VQACgkQEEnCBLXC DtaR3BAAwMZkawSMxne6Y/qU7aYe//UW7dau4Zu/PHb4R1KUI1dOeLLwhd1cfZxb OD/f4xwJfLyIE3PtBccSeeYS74dTV/3fZCQegyXvJJ5/sNxcYSwHEZZ3SDlwyMUF k0uUqrHNtuHsRE3mdCTduX4uAfplf9wQ6SRStd14Y8ddYAx5gsAlwTewl0ew4C1D 4nvLpLSo31/eJ96rbw20zgFSJrOhJ29Mk1HYDrVaWze3iTHPXV2I85UpKAGJwpJB GoYG2qPCvlIfzFjNjarwY77h+DSdwPuSf23tG08fM3fU2H/L5EAHyYWe9ZnGO5U+ m7yuRxuKo08WiWeeJ2WVTnvxRKyH6Eb8DBEAyzvE2YuIEivw8GFrJemBL1/Wt4pQ WINKFGQW/+8cKTTbXhZJsohhEhiQt1Fmo3jnX+dFGi5a+xeMYOBr2PtVivF3XqiL 05TlhU+afmzvPT1w+tjLIoEEPdb2YcTq4rwVNBRfeKVh0Ud0mbTUt3yrRaLBcnVl DFk6ij7G7jCsmVH8fYvg5lca1cIfZKMidhIzzBP1tna0X67UoRSrFte+g+HbGEWR 4wfYfawkuxGIoqbe3JUqr9yxUShnlcS+1aDr6kc4hGxlZWnl2LjKJmgtd5mnMB3m l56iWrsXjex/cLeuMUDdFh04oOHAxiH0BBUHLCitSrlZdZTl6G0= =cJsr -----END PGP SIGNATURE----- --Qz2CZ664xQdCRdPu--