Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3iQo-00062u-3Z for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2020 15:35:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j3iQm-0000RG-Fh for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Feb 2020 15:35:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j3iQl-0000Px-Uc for pgsql-hackers@lists.postgresql.org; Mon, 17 Feb 2020 15:35:32 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j3iQj-00072V-E2 for pgsql-hackers@lists.postgresql.org; Mon, 17 Feb 2020 15:35:30 +0000 Received: by mail-qt1-x843.google.com with SMTP id t13so12309244qto.3 for ; Mon, 17 Feb 2020 07:35:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=eVaZenY6kchjn0QXDjmD5dNCYveAIW4ZVLi2bUicd3w=; b=qx5DJvCUaqhn/b9saccnIsZUhD/ZAXX87nW+vTIUNx27COGlNohhAvVtJJbdk+XTUE wEusQSJg7UqBN/i5f/XCKLXHNfKezAenZ+NgHYymgqw1CVw3u8Ua6K/zsyuL/CqLVzf5 j0OFgxBO7XU6g9IVAGTZZ07k1YNdXkRSpFqQzFlBmOuPqdD6l1OJFgxWsKVmwgBU0+88 VfWuM16lC/XqTzCNvDZxrfQ2dpOGmyqt8rkeL7y0OrCxf0qJcebhvqUsKvdem8z1iDzA u6eHAicrLRoSeM0zRAc0hDe5aM8+cjD3AaRBOl7WKDU9JUSCiyekJlyPl3ODbWrxAMSb QTgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=eVaZenY6kchjn0QXDjmD5dNCYveAIW4ZVLi2bUicd3w=; b=GyvwegWYHpBfoj2OV70AXsoHdohonszK4ABGpBcWUkPj4m71m+2oxkXNZqLMkGwI2f CN91j0Lfml31QPPZmdXNtyUgstlJuF7w7IsbnJ84COW5zyL2xesZ55KG/siHUSmUeAeD 02BK0xe0c2mPaAAfK12dI6Hmg0iUEcO9a0lTEjM8oXlWlvqodHf/+Ibkh3GimxI4OB/p ESgVM19sS7dAUHMIGrrwEEarSJM3c8DwDmQ5C2YOvzV/HK0PsXO4SH2C/pI5xMEompXb ECsgJqi1cAlBxz/2+WTNzA45hKdEpQexrch3irCkuuwAwHouSv4zwxjq6OH+O4MO4KAd cw7w== X-Gm-Message-State: APjAAAVgLH1NLqREgsB9EKC3I7N2y25wM8dCkruSPBoObW4BO4+OX0TK T5qesE+KDiaJINmMXr4vZ5NXTg== X-Google-Smtp-Source: APXvYqwxwUsexP7ImVaCfOTI5SShUolIC4Pr/JPe+n6MMfZEp40C5cq/wrcXRLblNyYc5n4TtVspeQ== X-Received: by 2002:aed:3e53:: with SMTP id m19mr13709265qtf.387.1581953728512; Mon, 17 Feb 2020 07:35:28 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([201.186.80.6]) by smtp.gmail.com with ESMTPSA id z6sm392880qka.34.2020.02.17.07.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 07:35:27 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id ECD7A3006B9; Mon, 17 Feb 2020 12:35:25 -0300 (-03) Date: Mon, 17 Feb 2020 12:35:25 -0300 From: Alvaro Herrera To: Thomas Munro Cc: Tom Lane , Michael Paquier , Pg Hackers , Piotr Stefaniak Subject: Re: pgindent && weirdness Message-ID: <20200217153525.GA14354@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Feb-17, Thomas Munro wrote: > Thinking about this again: It's obviously not true that everything > that looks like a function call is not a cast. You could have > "my_cast(Type)" that expands to "(Type)" or some slightly more useful > variant of that, and then "my_cast(Type) -1" would, with this patch > applied, be reformatted as "my_cast(Type) - 1" because it'd err on the > side of thinking that the expression produces a value and therefore > the minus sign must be a binary operator that needs whitespace on both > sides, and that'd be wrong. However, it seems to me that macros that > expand to raw cast syntax (and I mean just "(Type)", not a complete > cast including the value to be cast, like "((Type) (x))") must be rare > and unusual things, and I think it's better to err on the side of > thinking that function-like macros are values, not casts. That's all > the change does, and fortunately the authors of indent showed how to > do that with their existing special cases for offsetof and sizeof; I'm > just extending that treatment to any identifier. Hmm ... this suggests to me that if you remove these alleged special cases for offsetof and sizeof, the new code handles them correctly anyway. Do you think it's worth giving that a try? Not because removing the special cases would have any value, but rather to see if anything interesting pops up. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services