Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krFi1-0004Et-Kr for pgsql-committers@arkaria.postgresql.org; Mon, 21 Dec 2020 07:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krFhz-0007vz-Dj for pgsql-committers@arkaria.postgresql.org; Mon, 21 Dec 2020 07:34:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krFhz-0007vs-8Q for pgsql-committers@lists.postgresql.org; Mon, 21 Dec 2020 07:34:19 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krFhv-0002XF-Ss for pgsql-committers@lists.postgresql.org; Mon, 21 Dec 2020 07:34:18 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id A721A419; Mon, 21 Dec 2020 02:34:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 21 Dec 2020 02:34:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=85so9RPGlYlRG9srLpZXMB9YauQ Fxn9npFkkE6kisr4=; b=1xp2wrCNRaag+8caNcKBEgcA5kEP7LKdU3eQkJglAyO IlfekNmqCym8luzrmAqCqHlxqncmUM/RoQQ0BA7Plu2yo4lp2r5tXRSYqTrIA/Uc sP4S2NlUdRYCn5HBdhoiBYUs8b4cEIO63Oe+9pFgoDsbP2k/rEWpm6BEXD83cMSG Pb99xzEayroBCmWDr0I4qQftHjUv0F74HOjTvo1b0zIo0nQLiSF7GJoyj5i5vuaR BzWoKp0A/xB+jd15er6THx0lFYcTSEbmzKIpjPPCCknGTu8fGd5oBVzdTWiBtdaA fTyzePG2Hd5fMdndkyi+3hsNBjzYjjdIj1DGBRPrG6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=85so9R PGlYlRG9srLpZXMB9YauQFxn9npFkkE6kisr4=; b=fMhNTMnQP4haMKy8ZO7kFO eWF3ghHYQG/ICd5qEPr91lEuZo7J3IYOCOjl4iCCsZDQjxgg83V67moF9BR5bvW1 43EVJ2qVXbCa50PZ0qJuINEBcEcul4R8+M8kbq1ygONv4Vth3ySthOHCBfFQxOUi HZ+HCH3LmaNAXInh+8nTVwS0rV9WM2Yzk7H5/21wpRhpkmhKB1kI4p1auKf22sCn 4dpPaHnVM1wwTP1qQW/jY4IyzCfECUaM0qJN1zK95SHW54PbvaemV0BQc5P9OViO jNvHj1PD1xSXyDspuBmoOVBnhi0ncFlvj59VI8ZR7Mqz+4Ft6hYghBHK5jAAzeRQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddtuddgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdefhedmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepffdufeeflefghfekudekkeev vddugfeiteekkeduleefvefhhffftdduffeiuedtnecuffhomhgrihhnpehpohhsthhgrh gvshhqlhdrohhrghenucfkphepudduuddruddtvddrudektddrudekheenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprg hquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id B69A0108005C; Mon, 21 Dec 2020 02:34:11 -0500 (EST) Date: Mon, 21 Dec 2020 16:34:09 +0900 From: Michael Paquier To: Alexander Korotkov Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Multirange datatypes Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xWKUD7b2q2EkdsK1" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --xWKUD7b2q2EkdsK1 Content-Type: multipart/mixed; boundary="v+fTdsQnATMa5HPo" Content-Disposition: inline --v+fTdsQnATMa5HPo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alexander, On Sun, Dec 20, 2020 at 04:21:16AM +0000, Alexander Korotkov wrote: > Multirange datatypes >=20 > Multiranges are basically sorted arrays of non-overlapping ranges with > set-theoretic operations defined over them. This commit is creating a compilation warning on Windows: multirangetypes.c(1033): warning C4715: 'multirange_constructor0' : not all control paths return a value See for example woodlouse: https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=3Dwoodlouse&d= t=3D2020-12-21%2001%3A42%3A28&stg=3Dmake Looking at the code, it is obvious that the compiler cannot understand that this should always return. Please find attached a suggestion of patch. Thanks, -- Michael --v+fTdsQnATMa5HPo Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="multirange-warning.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/utils/adt/multirangetypes.c b/src/backend/utils/ad= t/multirangetypes.c index a4dc439a21..06316ba6b6 100644 --- a/src/backend/utils/adt/multirangetypes.c +++ b/src/backend/utils/adt/multirangetypes.c @@ -1016,20 +1016,20 @@ multirange_constructor1(PG_FUNCTION_ARGS) Datum multirange_constructor0(PG_FUNCTION_ARGS) { - Oid mltrngtypid =3D get_fn_expr_rettype(fcinfo->flinfo); + Oid mltrngtypid; TypeCacheEntry *typcache; TypeCacheEntry *rangetyp; =20 + /* This should always be called without arguments */ + if (PG_NARGS() !=3D 0) + elog(ERROR, + "niladic multirange constructor must not receive arguments"); + + mltrngtypid =3D get_fn_expr_rettype(fcinfo->flinfo); typcache =3D multirange_get_typcache(fcinfo, mltrngtypid); rangetyp =3D typcache->rngtype; =20 - /* We should always be called with no arguments */ - - if (PG_NARGS() =3D=3D 0) - PG_RETURN_MULTIRANGE_P(make_multirange(mltrngtypid, rangetyp, 0, NULL)); - else - elog(ERROR, /* can't happen */ - "niladic multirange constructor must not receive arguments"); + PG_RETURN_MULTIRANGE_P(make_multirange(mltrngtypid, rangetyp, 0, NULL)); } =20 =20 --v+fTdsQnATMa5HPo-- --xWKUD7b2q2EkdsK1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl/gT/EACgkQnvQgOdby QH0/FA//WMJYefwou/gAm/o+C3Jvr7jtmn0LSyOU7Lq56Td36JTHX1NpvuZmn3Bl PGduSEI+16McAQuq1PlLIRqTYed8JJ9lP4V9cVprpo0kZOy/tEAjPB2UTzBV1uAk zVfkeHocBv+mQave1n5uhgGLPm29nDSzIkrFj0t+ZD99h4X6jzTZ9CGFVpJRmNbz 7F0tDMQeYkrzTyajmwYCJN4d0yS5OpC1uxnwZq2YH1Ni54Ff08QKktks4C3wKJBk VlHA6xTZRZF5S5BxCwXlmMs2GJF20atpvs27K/ULBtAG8XjH2v2nPEmyqF0FuSbo 9CpTbEr37pN4TNBZg77dxC42ZAevMqswGr013vULv91sBAMdXbysMLWjf7Rps1Qn TZ/mlA8xKyNp/7VhC0g72xGMT9gd/RvpUjwbZwiErXpwToF4uBKEde1a0ZfSIkpc Eky3o4P7/rcjDNIgc/LD+tTsfO+H8majCY6bIZqjL6EzD1deHyzfv6fgnjycQudW ry/HY0jRQlb1d11MEd/E7GfnRMbwXe91t5Ollr+q5DejX3t3n4kEIVVjQIzFUK5B POYAVLs/kVJaJYeki7ZDxOwGBJEvEppbnO6BMqw40ySgBJQ3+tzauKdcB5Bhct/E 1EZKlDKNLqJVxA8PjatKj3cFzeGfPFQ6XoMdo537d3YuOmZUlDo= =0Uge -----END PGP SIGNATURE----- --xWKUD7b2q2EkdsK1--