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 1kc1Wk-00010A-Ot for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 07:23:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kc1Wj-0002Zb-0p for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Nov 2020 07:23:45 +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 1kc1Wh-0002ZT-Pq for pgsql-hackers@lists.postgresql.org; Mon, 09 Nov 2020 07:23:44 +0000 Received: from wforward4-smtp.messagingengine.com ([64.147.123.34]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kc1Wd-00079U-Ff for pgsql-hackers@postgresql.org; Mon, 09 Nov 2020 07:23:42 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id 6125610C6; Mon, 9 Nov 2020 02:23:35 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 09 Nov 2020 02:23:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=dRxKqb8A7CbRiUBuEakFAkHEIYxzSEtzWAggEk3gB d4=; b=FANuzKlcAnOvQAtqaeim0Ksa5gJkqZ0ZK/pqpRGkc7BXtA2OU3dQAMPIf InVVJRD3GUuEhxmJNaniOoxHKjGHsUzCkPfF3HURDD3Vwe8hzVkl7Hyu6CUiAoEN BUUBC7Nv4GoIRpdTOqJoNrd1MNxRNs5tUX1UEZ2npai+p53rTgXzHb+l1jACdpxz DRiRhAAHUmXJ1o/m07ypNWxffea1KkM2QlyJNFJDgdjNQomUhNJuoCWDcIb8vwa8 ipOTWGx7Re9XELD/NLf6MMuEr3UT34ljlHFKaf8NHgrHnDr3NhBTg9kI7s+1sfH8 sHxm7izHIuFRcMVDjcb0K6M9R4v1g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddugedguddutdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefheenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnh guqhhurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeevueetledvuedugffg vedugeduhfdvkeegueefhfdtgeeuudeghfehueegfefhieenucffohhmrghinhepvdhnug hquhgrughrrghnthdrtghomhenucfkphepkeejrddujeejrdejhedrleegnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghish gvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p57b14b5e.dip0.t-ipconnect.de [87.177.75.94]) by mail.messagingengine.com (Postfix) with ESMTPA id BBD723063067; Mon, 9 Nov 2020 02:23:33 -0500 (EST) Subject: Re: warn_unused_results To: Michael Paquier References: <20201109065606.GA11424@paquier.xyz> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <8ef6a7dc-5ea1-46b3-4406-7be7d07886f0@2ndquadrant.com> Date: Mon, 9 Nov 2020 08:23:31 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20201109065606.GA11424@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-11-09 07:56, Michael Paquier wrote: > This is accepted by clang, and MSVC has visibly an equivalent for > that, as of VS 2012: > #elif defined(_MSC_VER) && (_MSC_VER >= 1700) > #define pg_nodiscard _Check_return_ > We don't care about the 1700 condition as we support only >= 1800 on > HEAD, and in this case the addition of pg_nodiscard would be required > on the definition and the declaration. Should it be added? It is > much more invasive than the gcc/clang equivalent though.. AFAICT from the documentation, this only applies for special "analyze" runs, not as a normal compiler warning. Do we have any support for analyze runs with MSVC? > FWIW, I saw an extra case with parsePGArray() today. AFAICT, that's more in the category of checking for error returns, which is similar to the "fortify" options that some environments have for checking the return of fwrite() etc. > I am not sure > about the addition of repalloc(), as it is quite obvious that one has > to use its result. Lists are fine, these are proper to PG internals > and beginners tend to be easily confused in the way to use them. realloc() is listed in the GCC documentation as the reason this option exists, and glibc tags its realloc() with this attribute, so doing the same for repalloc() seems sensible. -- Peter Eisentraut 2ndQuadrant, an EDB company https://www.2ndquadrant.com/