Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWOBI-0007Nd-US for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 15:08:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eWOBI-0002lm-JD for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Jan 2018 15:08:44 +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 1eWOAt-00074i-C7 for pgsql-hackers@lists.postgresql.org; Tue, 02 Jan 2018 15:08:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eWOAp-0002wi-BV for pgsql-hackers@lists.postgresql.org; Tue, 02 Jan 2018 15:08:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w02F8AjV031839; Tue, 2 Jan 2018 10:08:10 -0500 From: Tom Lane To: Alvaro Herrera cc: Darafei =?utf-8?B?IktvbdGPcGEi?= Praliaskouski , pgsql-hackers@lists.postgresql.org Subject: Re: Better testing coverage and unified coding for plpgsql loops In-reply-to: <20180102134623.4mhrbnc2im6bfp7a@alvherre.pgsql> References: <20180102134623.4mhrbnc2im6bfp7a@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 02 Jan 2018 10:46:23 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <31837.1514905690.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 02 Jan 2018 10:08:10 -0500 Message-ID: <31838.1514905690@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > Darafei "Komяpa" Praliaskouski wrote: >> - can this macro become a function? > The "exit_action" argument makes it tough. It can probably be done -- > it seems to require contorting the one callsite that uses "goto" though. It could be converted into a function returning bool, a la if (!loop_rc_processing(...)) break; but then the burden is on you to show there's negligible performance impact, a question that doesn't arise when just macro-izing existing code. I suppose the function could be made inline, but then we're right back to the question of how well lcov will display the actual code coverage. regards, tom lane