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 1kVsDT-0002t0-7n for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Oct 2020 08:14:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kVsDQ-0004F8-0K for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Oct 2020 08:14:24 +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 1kVsDP-0004F1-PN for pgsql-hackers@lists.postgresql.org; Fri, 23 Oct 2020 08:14:23 +0000 Received: from wforward5-smtp.messagingengine.com ([64.147.123.35]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVsDI-00030f-NT for pgsql-hackers@postgresql.org; Fri, 23 Oct 2020 08:14:23 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.west.internal (Postfix) with ESMTP id 30033DD8; Fri, 23 Oct 2020 04:14:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 23 Oct 2020 04:14:14 -0400 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=6pYhxPQRejuDyblrQlAYtLNhngwm7i1s3AduaA1Nx iM=; b=JCYQ1iWxlrdmH+2AH1dnnMRTGTL+M+2/6aAJ8jn4K/eWJ3BCbJxBHB/RH OWM3qTP1Ka6UCVYibF5vVilBOaPijKT73uXvgaYwjaZ5GM2FCFG43GwRpKVOFYYG iyT6AG/GK38FbHqAW82UZvIONGDZdwdtOAxeSUzNpQaclV551qQkC25bFAcfcmnR ZOG8LJtsP6tKrvHX/Hiy/f5QZF4jGZvSftQcL8sijsqJ789jMeFy17p3uy4u9U46 DMfQ5X5iP3CwJ46yAtW9TkNuY7S80IO8g7/EcgAL4JSNZfdhSkSCF7jGoO90dDWq tHgf88LyM5M/RhZhhTmHx/W8Cw1iA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkedtucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefuvfhfhfhokffffgggjggtgfesthejredttd efjeenucfhrhhomheprfgvthgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghi shgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhmqeenucggtffrrghtthgvrh hnpedtveeghedtjedvvedvleejueevjeejtdellefgkeelfeeikeejlefgkedtudeuvden ucffohhmrghinhepvdhnughquhgrughrrghnthdrtghomhenucfkphepkeejrddujeejrd ejuddrvddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnughquhgrughrrghnthdrtghomh X-ME-Proxy: Received: from april.pezone.net (p57b147e3.dip0.t-ipconnect.de [87.177.71.227]) by mail.messagingengine.com (Postfix) with ESMTPA id 1145D3064683; Fri, 23 Oct 2020 04:14:12 -0400 (EDT) Subject: Re: warn_unused_results To: Tom Lane References: <118217.1602950306@sss.pgh.pa.us> Cc: pgsql-hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <819ae3bf-ecb5-84c4-c30c-9990d0a7bfca@2ndquadrant.com> Date: Fri, 23 Oct 2020 10:14:12 +0200 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: <118217.1602950306@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; 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-10-17 17:58, Tom Lane wrote: > Peter Eisentraut writes: >> Forgetting to assign the return value of list APIs such as lappend() is >> a perennial favorite. The compiler can help point out such mistakes. >> GCC has an attribute warn_unused_results. Also C++ has standardized >> this under the name "nodiscard", and C has a proposal to do the same >> [0]. In my patch I call the symbol pg_nodiscard, so that perhaps in a >> distant future one only has to do s/pg_nodiscard/nodiscard/ or something >> similar. Also, the name is short enough that it doesn't mess up the >> formatting of function declarations too much. > > +1 in principle (I've not read the patch in detail); but I wonder what > pgindent does with these added keywords. pgindent doesn't seem to want to change anything about the patched files as I had sent them. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services